简体   繁体   中英

PHP script not running from cron

I have the following command:

php /var/www/html/XYZ/api_new/XYZ-API/src/public/fetch_events/fetch_events.php

This runs perfectly from the command line. However, I want it to run as a cron job every 15 mins, so I added the following entry to my crontab:

15 * * * * php /var/www/html/XYZ/api_new/XYZ-API/src/public/fetch_events/fetch_events.php

This however, does not seem to work at all. It does not even show up in my system logs (all my other cron jobs do show up).

Any ideas?

There's not really enough information to answer your question, but here are some things that might help.

Sometimes cronjobs don't have context for where to find these programs, so do which php and replace the full path with the php command.

/var/log/cron should have a record of it running, but if there's a problem, you might not know why. Try appending the following to the end of the cron line to aid in debuging:

>> /tmp/fetch_events.log 2>&1

This file will probably contain some hints as to what's going on when the cron does fire.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM