Jump to content
rklau

Problem Executing Php File Via Cron

Recommended Posts

Hi -

 

I recently installed an RSS aggregator that is written in PHP and has a mySQL backend. (It's here if you want to check it out.)

 

There's a way to automatically update all feeds using a page included with the app - called update-quiet.php.

 

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.

 

I thought it should be (in the entry for the command to execute via C-Panel's manage cron jobs):

 

php /home/xxxxxxx/public_html/directory/update-quiet.php

 

(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.)

 

Any idea why that's not working? What should this look like?

 

--Rick

Tech blog

Share this post


Link to post
Share on other sites
php /home/xxxxxxx/public_html/directory/update-quiet.php

 

(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.)

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.

 

-Alan

Share this post


Link to post
Share on other sites

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 http://domain.com/path/to/file.php" and that is now working.

 

Note: I have the directory this file is in password-protected, and to authenticate I'm actually using the URL: http://user:password@domain.com/path/to/file.php.

 

Thanks for the help!

Share this post


Link to post
Share on other sites

Oh really? That authentication works for the cron job in a password-protected directory?

 

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!

 

Thank you for your help as well, rklau!

Edited by TCH-Robert

Share this post


Link to post
Share on other sites

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?

 

Thanks,

Sandro

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...