Page is a not externally linkable
- Hardware and OS Related Technologies
-- Linux, Unix, and *nix like Operating Systems
---- Cron Job PHP Problem


Emperor - 4:48 pm on Sep 3, 2005 (gmt 0)


Hi guys,

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:

php /usr/www/myname/mysite/jobs/main.php

...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:

fopen("/usr/www/myname/mysite/www/includes/banner.inc","w");

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.

Thanks.


Thread source:: http://www.webmasterworld.com/linux/1545.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com