Webserver: Cron problem

After setting-up some cron jobs in my webserver, after checking the logs, I realised a Permission denied message.

The first thing that came to my mind, was that the user running the cron job with the error didn't have access to the file. This would awkward since the user cron job and the web-server user were the same.

I didn't find any solutions in the forums of the php framework I use, so I just googled it and stepped into this.

I read all the comments, and finally the solution came to me through glued2(10-15-2005, 09:08 PM) saying:
"call the php script with the same command as the cron script does (probably php -q /var/www/script.php)".
It was then that I undestood what was going on. I am mostly(if not completely) using debian-based linux OS, apache and php. By saying that, I falsely assumed that cron was going to "understand" that I was using a php file as a command and it should run php by its own.

To conclude, let's say I have cron file in /var/www:
CorrectFalse
* * * * * wget http://www.example.com/cron.php
* * * * * /var/www/cron.php


Cron is a program used for general purposes. It's not mathematics. It's just general knowledge. Many of the programs I use, even in my home pc, have been running cron jobs. For some reason, I forgot. :-P

Comments

Popular Posts