zPanel Cron Not Working? Can not add cron or task not being executed

November 29, 2014 6.8k views

Hi we have zPanel 10.1
Im trying to add cron but its not working, im getting script does not exist error or when path is accepted our script file is not actual executed :(

here is what i tried:

php -q  /var/zpanel/hostdata/<*account*>/public_html/<*domain*>/api/cron/index.php


php -q  /<*domain*>/api/cron/index.php

says script does not exist

I can add something like this:


but file is not being executed :(

Crontab is running, process is up and i see zPanels internal things are being executed just fine.

tnx for help!

8 Answers

says script does not exist
Did you check the path for the file is correct, and the file really exists?

also, check if the file has read/exec permissions for cron owner.

check /var/log/cron if it throws any errors, as well as /var/log/messages to shed some light

path exist, i copy and paste :)


it did give me an error running under root

-bash: /var/log/cron: Permission denied

Messages log is empty. Only iptables info is there and old one

did you create the cron entry from within zpanel or manually?

are you sure you check the cron log as su?

paste ls -l output for the script path and full cron entry.

  • I used zPanel web interface (im not extremely good with linux)

    [root@01 ~]# sudo su
    [root@01 ~]# /var/log/cron
    bash: /var/log/cron: Permission denied

    what "ls -l" only gives me list of files in directory im curently in, what do i do with it?

    By the way tnx for taking time helping me ;)

  • ls -l /path/where/the/php/file/is/supposed/to/be


I see, you wanted to execute the file instead of view it.

cat /var/log/cron

will give you the output of the file. also:

tail -n 60 /var/log/cron

will show last 60 lines.

to view cron entries, type:

crontab -u apache -l

as su user. this should give you all the cronjobs ran by your web server/zpanel

  • cat /var/log/cron

    gave me log file i need alredy, thats where i see zPanle files but not mine nor any errors (well hourly one output is bush not fond or something)

    Nov 29 17:01:01 01 crond[14335]: (root) CMD (root run-parts /etc/cron.hourly)
    Nov 29 17:05:01 01 crond[14407]: (root) CMD (root /usr/bin/php -q /etc/zpanel/panel/bin/daemon.php >> /dev/null 2>&1)
    Nov 29 17:10:01 01 crond[14484]: (root) CMD (root /usr/bin/php -q /etc/zpanel/panel/bin/daemon.php >> /dev/null 2>&1)
    Nov 29 17:15:01 01 crond[14553]: (root) CMD (root /usr/bin/php -q /etc/zpanel/panel/bin/daemon.php >> /dev/null 2>&1)
    Nov 29 17:20:01 01 crond[14614]: (root) CMD (root /usr/bin/php -q /etc/zpanel/panel/bin/daemon.php >> /dev/null 2>&1)
    Nov 29 17:25:01 01 crond[14678]: (root) CMD (root /usr/bin/php -q /etc/zpanel/panel/bin/daemon.php >> /dev/null 2>&1)
    Nov 29 17:30:01 01 crond[14742]: (root) CMD (root /usr/bin/php -q /etc/zpanel/panel/bin/daemon.php >> /dev/null 2>&1)
    Nov 29 17:35:01 01 crond[14810]: (root) CMD (root /usr/bin/php -q /etc/zpanel/panel/bin/daemon.php >> /dev/null 2>&1)
    Nov 29 17:40:01 01 crond[15097]: (root) CMD (root /usr/bin/php -q /etc/zpanel/panel/bin/daemon.php >> /dev/null 2>&1)
    Nov 29 17:45:01 01 crond[15174]: (root) CMD (root /usr/bin/php -q /etc/zpanel/panel/bin/daemon.php >> /dev/null 2>&1)
    Nov 29 17:50:01 01 crond[15280]: (root) CMD (root /usr/bin/php -q /etc/zpanel/panel/bin/daemon.php >> /dev/null 2>&1)
    Nov 29 17:55:01 01 crond[15361]: (root) CMD (root /usr/bin/php -q /etc/zpanel/panel/bin/daemon.php >> /dev/null 2>&1)
    Nov 29 18:00:01 01 crond[15417]: (root) CMD (root /usr/bin/php -q /etc/zpanel/panel/bin/daemon.php >> /dev/null 2>&1)
    Nov 29 18:01:01 ny crond[15428]: (root) CMD (root run-parts /etc/cron.hourly)
    Nov 29 18:05:01 ny crond[15479]: (root) CMD (root /usr/bin/php -q /etc/zpanel/panel/bin/daemon.php >> /dev/null 2>&1)

    tail -n 60 /var/log/cron - shows same thing

    crontab -u apache -l - permission denied.

    So we know there are other cron jobs, problem is hot to add new one preferably through zPanel UI, worst case i survive if i add few manually, but if UI is there i think it should work

  • as to LS

    it shows my index.php is there

    [root@01 ~]# ls -l /var/zpanel/hostdata/<account>/public_html/<domain>/api/cron
    total 4
    -rw-r--r-- 1 root root 697 Nov 28 01:24 index.php
  • the file should be owned by the same user the domain/account files are owned by, not root, e.g. apache:apache.

    check what ownership is for other files within the path (with the same ls -l command)


    and set the same for the cron.php file with

    sudo chown user:group /path/to/index.php

crontab -u apache -l - permission denied.

^ you may be trying to access cron as default user, not root...

try one more thing from /var/log/cron (if the output here is not the full output - if that's all there is, you can omit this part):

grep "api/cron/index.php" /var/log/cron

will show you if the command is even taken into consideration. if the output shows nothing, it means the command is not being executed as it might have wrong file permissions, i.e. not being executable by webserver user.

if there is no entry in cron log, it means the script is really not being executed.
output of:

grep "api/cron/index.php" /var/log/messages

might show you any permission errors.

from the command line, try executing the script (as root):

php /var/zpanel/hostdata/<*account*>/public_html/<*domain*>/api/cron/index.php

(without -q option) to see if there are any errors while executing it.

and, for the script path for your cron entry, try setting:


not sure about zpanel, but this might be the correct path for files.

  • for manual cron entry, you also should use web user cron, not root.

    if crontab command fails, all the crons are placed in


    directory. check if the files inside have the command you set up (most probably apache cron). if not, add it manually:

    * * * * * /usr/bin/php -q /var/zpanel/hostdata/<*account*>/public_html/<*domain*>/api/cron/index.php > /dev/null 2>&1 

    the asterisks represent times of cron entry execution:

    minute hour day-of-month month day-of-week

  • im about to reach maximum brain temperature :(

    grerep did not help, nothing is outputted, im both cases

    php /var/zpanel/hostdata/<*account*>/public_html/<*domain*>/api/cron/index.php

    this worked fine, script generated email and i got it delivered, so script working this way.
    what i noticed though, if i acces script through web browser i get email form Apache, and here i got email form Root

    as to


    zPanel refused that, saying script does not exist :(

    how do i check ownership?

  • you can check ownership with ls -l command. as I wrote before:

    ls -l /var/zpanel/hostdata/<account>/public_html/<domain>/

    will show you who the files are owned by. instead of

    root root

    as it was the case with index.php output, you chould get other user/group and set the permissions for index.php to be the same, e.g. if files under /var/zpanel/hostdata/<account>/public_html/<domain>/

    show they're owned by

    apache apache


    [user@machine] $ ls -l /var/zpanel/hostdata/<account>/public_html/<domain>/
    -rw-r--r--  1 apache apache 3.2K Nov 18 20:00 index.php



    sudo chmod apache:apache /var/zpanel/hostdata/<*account*>/public_html/<*domain*>/api/cron/index.php

    to edit cron from command line, you should run:

    sudo crontab -u apache -e

    add the entry:

    */10 * * * * /usr/bin/php -q /var/zpanel/hostdata/<*account*>/public_html/<*domain*>/api/cron/index.php > /dev/null 2>&1 

    (most probably the defaul crontab editor is vi, in that case, to edit the file hit 'i', after editing hit [ESC] key, to save type: ':wq' - without inverted commas)

    this will run the command every 10 minutes.

    i acces script through web browser i get email form Apache, and here i got email form Root

    this is because if you run the command from command line, you run it as the user you are logged in as (in your case root). if you run it from web browser, it is ran by apache (web server user).

    also, another possibility for cronjob would be to make the cron "visit" webpage with the cron file like this:

    */10 * * * * wget -q -O /dev/null "" > /dev/null 2>&1

    this is the same as cronjob with filepath.

  • [root@01 ~]# sudo chmod apache:apache /var/zpanel/hostdata/<account>/public_html/<domain>/api/cron/index.php
    chmod: invalid mode: `apache:apache'
    Try `chmod --help' for more information.

    Did i do something wrong?

  • sorry, that's my mistake.

    i gave you wrong command the second time. just chage chmod to chown and it will change ownership as here:


  • ok chown worked

    but is not working, the "vi" does not start, Did i do something wrong?

    sudo crontab -u apache -e
  • did anything at all open up when you typed the command?

  • sorry for delayed reply,
    when i typed that command nothing happened at all. just new line pop up waiting for new command input

how to i switch to " web user cron"

whats my settings for 10 min?

Any luck on getting this resolved?

i used wget as work around.
later on in the log i found that "index.php" i was referring to was executing differently when requested from Cron rather then a browser. So i think if i make it look at different includes it would work. PHP error was found in apache error logs for that domain

Have another answer? Share your knowledge.