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

https://support.plesk.com/hc/en-us/articles/12377377419287-How-to-run-a-PHP-script-using-a-custom-PHP-executable-in-Plesk-Scheduled-Tasks-

  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.

Similar Posts