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-
- Log into Plesk.
- Go to Tools & Settings > Scheduled Task > Add Task;
- 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;
- At Run field, specify the desired frequency the task should be run;
- Choose the Run a PHP script and set required version:
- 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.
- Create a task with the type Run a command and specify the full path to custom PHP executable. Specify other settings if required.
- Go to Tools & Settings > Scheduled Tasks > Settings and set the option Crontab shell to /bin/bash .
- Apply the changes.
Note: it is also possible to do it per domain via Domains > example.com > Scheduled Tasks.