FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Cron Jobs and Php





Slammer
hey, ive had this working before on frihost, but i cant seem to get it working again. What is the best commands to use in the standard cron tab in cpanel to get a php script to run at the set interval?

Thanks a lot
Slammer
devadutta
In your cpanel, There is a cron jobs tab. There, go and select the details of when to run the script. eg once a day, once every 5 minutes etc.
In the command box, enter the command
php -f /home/<your-user-name>/www/<yourscript>.php
Voila!
Slammer
works great.

Thanks Smile
blueknot
heya, i wanted to find issue pertaining to this, and this is what i am looking for ?

thks.

P.s I have use the search bar Smile
Daniel15
actually, I use another command.

What I use is php -q /....../file.php. I'm not really sure what the difference is, but people recommend to use -q as opposed to -f

And most of the time I use the full path to PHP as well (that is, /usr/bin/php -q /....../file.php
thnn
Yes I would personally use the full path so:

Code:
usr/bin/php -q /home/username/path/to/cronjob.php
Bondings
Also, don't let it be executed every few minutes, certainly if it takes more than one second to be executed. Wink
Daniel15
How did you find this thread thnn? It's from September! Maybe I should -close- it.

And, /usr/bin/php -q omits the headers from the output. That's why it's better for cron jobs. If an error does occur and you use /usr/bin/php -f, you'd get some HTTP headers in the output, which is not what you want.
Related topics
Cron Jobs
Cron Jobs
Cron jobs - running a php file
Executing automated tasks without using cron jobs
cron jobs?
Problems With Cron Jobs
Enabling Cron Jobs
Question: PHP scripting + cron jobs
CRON Jobs
how do cron jobs work?
Cron jobs on DirectAdmin
Cron jobs and PHP?
Cron jobs
Has anyone installed Moodle successfully?
[Urgent] Cron Jobs
This topic is locked: you cannot edit posts or make replies.    Frihost Forum Index -> Support and Web Hosting -> Web Hosting Support

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.