I am running Ubunutu Linux server, PHP5, Apache2 and am having trouble getting any sort of cronjob to run through the crontab.
I edit the crontab using
crontab -e
I save the file I want to run:
*/5 * * * * php /home/user/public_html/crx/cronx.php
it saves fine. I can run the file from the console and goes through fine. I can’t even find any existing logs for the file. I checked cron was running, stopped and started… no change.
The current php file is just a simple test script that inserts a single line into a database.
I checked the permissions for the file and has read and write. Am absolutely stumped. I can’t seem to get ANYTHING to run through cron. Is there something I can run to test permissions?
EDIT
I have also tried the following command
- /usr/bin/php /home/user/public_html/crx/cronx.php
I used whereis php and which php to locate and confirm it is all running in the right area
You have too many
*values for your times.Also, cron may not have a
PATHset up correctly to use PHP.Instead try:
Where
/usr/bin/phpis the actual path to PHP. From the console you can runwhich phpto see the path to the PHP binary you should use.EDIT: Here are a couple of more things to try in order to troubleshoot:
Another option:
Set the permissions of your PHP script to
755, and change the beginning to:Then change your cron tab to:
I’m still not sure if cron is the issue or the running of the PHP script.