Welcome to WebmasterWorld Guest from 184.108.40.206
Forum Moderators: bakedjake
I set up a cron job to execute a PHP script that writes a file and it isn't working. I can't tell if the cron job itself or the PHP script is failing.
If I type this on the command line it works fine:
...and here is my crontab entry (for testing):
* * * * * php /usr/www/myname/mysite/jobs/main.php
...which seems fine.
One thing I can think of is the path to the file in the PHP code. I gave it the full path like so:
Since it's getting called in the crontab maybe I have to do something different? What about the permissions for the main.php file, does that need anything special? Like I said, it works on the command line so I don't know what I could be doing wrong.
just two things to check first:
-1- the crontab-user may not have the same environment as you have when testing and running the /your/path/to/php command, so you would be on the safe side to specify the full path of the php interpreter in the crontab.
-2- the permissions of the main.php file may be important or not, depending on the file-ownership of the main.php (and the directory above) and its relation to the crontab-user.