Can not run the php script using cron


This question already has an answer here:

  • Cannot get PHP cron script to run 4 answers

I am running a php script using cron. The name of the file is : PriceChecker.php . This is my cron script

# m h  dom mon dow   command
0 07,11,16,20 * * * php /var/www/mainsite/PriceChecker.php
* * * * * /var/www/mainsite/

The shell script is:

php PriceChecker.php >logger.log

The first line is the original. The second is for testing I have tried various variations including: /usr/bin/php /var/www/mainsite/PriceChecker.php

If I log the out in the cron php /var/www/mainsite/PriceChecker.php > logfile.log

The logfile is created, but is empty

Same as here, I think Cannot get PHP cron script to run

You forgot to specify the user name you want your script to be run as.