Cron Job not Running

Are you running it from the CLI and from cron with the same user? If you run it from CLI as a normal user and from cron with root, root may be missing some environment variables your cron.php needs.

You could try running from root cron with something like:

su - userToRunAs -c "/usr/bin/php /var/www/support_web/api/cron.php"

The cron files must have a user/group of root/root(/etc/cron* and /etc/cron.{daily,hourly,etc}/* must be owned by root, otherwise the scripts within will not fire off.

I don't know about personal crontabs under /var/spool/cron/$username. My personal experience, though, suggests that it's root/"user's group"

There are also some permissions requirements, but I don't know what those are. I do know, though, that 755 works.


It's hard to say exactly, but it might be an environment variable that you have set in your interactive shell, but that isn't being set by cron. Put some print statements in cron.php that print out any environment variables that depends on, so you can see if it's properly set.

If that fails, add more print statements to see what's going on.


If the script for example lies in a directory such as cron.daily where files are executed automatically, some implementations of cron always run them with sh regardless of the shebang. Try to create simple sh-script that simply calls /usr/bin/php /var/www/support_web/api/cron.php.