Symptoms
-
When executing a scheduled task that runs a command to execute a script in Plesk, it returns a Permission denied error:
Task " php -q /var/www/vhosts/example.com/httpdocs/wp-cron.php" completed with error in 0 seconds, output:
-: /dev/null: Permission denied
Task " php -q /var/www/vhosts/example.com/httpdocs/wp-cron.php" completed with error in 0 seconds, output:
-: php: command not found
Cause
Lack of permissions on the script file or missing command in the chroot environment.
Resolution
-
Change the shell for the subscription to /bin/bash in Subscriptions > example.com > Web Hosting Settings > Access to the server over SSH.
Note: The next step is not necessary in case the executable file cannot be accessed via Plesk File manager.
-
Correct permissions or task type.