Articles in this section

How to run a PHP script using a custom PHP executable in Plesk Scheduled Tasks?

kb: how-to Plesk for Linux ABT: Group A

Applicable to:

  • Plesk for Linux

Question

How to run a PHP script using a custom PHP executable in Plesk Scheduled Tasks?

Answer

  1. Log into Plesk.
  2. Go to Tools & Settings > Scheduled Task > Add Task;

  3. At Script Path, specify the full path to the PHP script on the server. If arguments are needed, specify that accordingly in the with arguments field;
  4. At Run field, specify the desired frequency the task should be run; 
  5. Choose the Run a PHP script and set required version:

    Click Install
  6. Click OK to save the task.

Note: Alternatively, it is possible to do it via the Run a command option on the same screen. However, this is not recommended way due to security reasons as the script will be running under /bin/bash privileges.

  1. Create a task with the type Run a command and specify the full path to custom PHP executable. Specify other settings if required.

    Screenshot-2017-12-3_Schedule_a_Task_-_Plesk_Onyx_17_5_3.png

  2. Go to Tools & Settings > Scheduled Tasks > Settings and set the option Crontab shell to /bin/bash .

  3. Apply the changes.

Note: it is also possible to do it per domain via Domains > example.com > Scheduled Tasks.

Additional Information

How to schedule a task in Plesk for Linux?

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.