Crontab does not execute a command in PHP

0

On a CentOS 7 machine I have the following line in crontab

0 21 * * * php -q /data/wwwroot/central/crons/cron.php >/dev/null 2>&1

But at the specified time it does not perform the task. And in the log the result is eh

Sep 27 21:00:01 brinsley CROND[6154]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Sep 27 21:00:01 brinsley CROND[6155]: (root) CMD (php -q /data/wwwroot/central/crons/cron.php >/dev/null 2>&1)

But, if I in the terminal, even if in the putty simply typing the command and giving an enter it executes in a normal way. Exactly the same command as eh:

php -q /data/wwwroot/central/crons/cron.php >/dev/null 2>&1

So, how could I see a way to execute this script correctly?

    
asked by anonymous 28.09.2017 / 02:10

1 answer

0

You should put the path to php before the command, for example:

0 21 * * * /usr/local/bin/php /data/wwwroot/central/crons/cron.php >/dev/null 2>&1
    
28.09.2017 / 02:16