Problem Executing Php File Via Cron

liunx

Guest
Hi -<br /><br />I recently installed an RSS aggregator that is written in PHP and has a mySQL backend. (It's <a href="http://minutillo.com/steve/feedonfeeds/" target="_blank">here</a> if you want to check it out.)<br /><br />There's a way to automatically update all feeds using a page included with the app - called update-quiet.php.<br /><br />I should be able to schedule a cron job to run this page periodically, but for the life of me I can't figure out the right command.<br /><br />I thought it should be (in the entry for the command to execute via C-Panel's manage cron jobs):<br /><br />php /home/xxxxxxx/public_html/directory/update-quiet.php<br /><br />(When I run that w/e-mail notification enabled, I get a message that includes the headers of the php file, but it has not actually executed the script.)<br /><br />Any idea why that's not working? What should this look like?<br /><br />--Rick<br /><a href="http://www.rklau.com/tins/" target="_blank">Tech blog</a><!--content-->
This is how I run PHP through cron:<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->GET http://www.mysite.com/path/to/file.php<!--c2--></div><!--ec2--><!--content-->
<!--QuoteBegin-rklau+Jan 16 2004, 10:01 AM--><div class='quotetop'>QUOTE(rklau @ Jan 16 2004, 10:01 AM)</div><div class='quotemain'><!--QuoteEBegin-->php /home/xxxxxxx/public_html/directory/update-quiet.php<br /><br />(When I run that w/e-mail notification enabled, I get a message that includes the headers of the php file, but it has not actually executed the script.)<!--QuoteEnd--></div><!--QuoteEEnd--><br />Hrm, tat's exactly the form of a php cron job that I run. I'm not sure in this case if the file's permission's matter, but it's worth checking; is the file set to execute? Does the script work properly if you run it through your browser (ie, pointing the browser to yourdomain/directory/update-quiet.php)? Checking that might help with troubleshooting.<br /><br />-Alan<!--content-->
Oddly enough, it does work when I execute directly, and the script's permissions were set properly. In any event, I followed the instructions to use "GET <a href="http://domain.com/path/to/file.php"" target="_blank">http://domain.com/path/to/file.php"</a> and that is now working.<br /><br />Note: I have the directory this file is in password-protected, and to authenticate I'm actually using the URL: <a href="http://user:p[email protected]/path/to/file.php" target="_blank">http://user:p[email protected]/path/to/file.php</a>.<br /><br />Thanks for the help!<!--content-->
Oh really? That authentication works for the cron job in a password-protected directory?<br /><br />I'm extremely happy to read that you can do that. I do believe that I will be adding that kind of protection to my cronned scripts!<br /><br />Thank <u>you</u> for your help as well, rklau!<!--content-->
Sorry to bring up such an old topic, but it actually helped me. I was wondering, however, can I leave the email field blank so the script will not email me everytime it runs?<br /><br />Thanks,<br />Sandro<!--content-->
Hi Sandro,<br /><br />Add<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->> /dev/null<!--c2--></div><!--ec2-->on the end of the cron line<!--content-->
 
Back
Top