Articles in this section

Running a Cron job via Scheduled Tasks in Plesk fails: Permission denied

Plesk for Linux kb: technical ABT: Group B

Applicable to:

  • Plesk for Linux

Symptoms

  • When executing a scheduled task that runs a command to execute a script in Plesk, it returns a Permission denied error:

    PLESK_ERROR: Task " php -q /var/www/vhosts/example.com/httpdocs/wp-cron.php" completed with error in 0 seconds, output:
    -: /dev/null: Permission denied


    PLESK_ERROR: 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

  1. Log in to Plesk.
  2. 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.

  3. Correct permissions or task type.
    • For shell scripts:

      Find the affected file in Domains > example.com > File Manager and add executable permissions:

    • For the .php scripts:

      Recreate the task as Run a PHP script one in Domains > example.com > Scheduled Tasks > Add Task:

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.