eric
eric

Reputation: 11

Php cronjob doesn't run

I have 3 Debian servers. For years I was using this command to run a php cronjob:

19,56 * * * * /usr/bin/php /home/sites/cron.php >/dev/null 2>&1

it works on my first server. On the second server it doesn't work and I use:

19,56 * * * * php -f /home/sites/cron.php >/dev/null 2>&1

on the third server don't work any commands. I tried:

19,56 * * * * /usr/bin/php /home/sites/cron.php >/dev/null 2>&1
19,56 * * * * /usr/bin/php -f /home/sites/cron.php >/dev/null 2>&1
19,56 * * * * /usr/bin/php -q -f /home/sites/cron.php >/dev/null 2>&1
19,56 * * * * php -f /home/sites/cron.php >/dev/null 2>&1
19,56 * * * * php -q -f /home/sites/cron.php >/dev/null 2>&1
19,56 * * * * php /home/sites/cron.php >/dev/null 2>&1

whereis php 
php: /usr/bin/php /usr/share/man/man1/php.1.gz


19,56 * * * * /usr/bin/wget -O - -q -t 1 http://www.example.com/cron.php 

I am getting crazy. Never in my life had problems like this. Any ideas how to set up a cronjob? Thanks.

Upvotes: 1

Views: 1682

Answers (1)

Barun
Barun

Reputation: 2652

Please post the relevant error messages. Reschedule the cron job like this:

19,56 * * * * /usr/bin/php /home/sites/cron.php > /home/<user>/cron.err 2>&1

Look what is present in the file /home//cron.err. Or simply run the command in a terminal

/usr/bin/php /home/sites/cron.php

and verify if it is working.

Upvotes: 1

Related Questions