PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Sat Jun 06, 2020 5:35 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: PHP cronjob
PostPosted: Tue May 12, 2009 5:06 pm 
Offline
Forum Contributor

Joined: Tue Jun 17, 2008 8:12 pm
Posts: 221
How do I run a php script in cronjob (the php script contains only mysql queries)?


Top
 Profile  
 
 Post subject: Re: PHP cronjob
PostPosted: Tue May 12, 2009 5:47 pm 
Offline
Briney Mod
User avatar

Joined: Mon Jan 19, 2004 7:11 pm
Posts: 6446
Location: 53.01N x 112.48W
You'll have to put a shell command inside your crontab file. Usually that can be done by calling crontab -e as root. Alternatively, you can make your PHP file executable, and put it in the appropriate cron.daily, cron.hourly, etc directories (if your Linux distro has those directories).

_________________
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.


Top
 Profile  
 
 Post subject: Re: PHP cronjob
PostPosted: Tue May 12, 2009 5:50 pm 
Offline
DevNet Master
User avatar

Joined: Fri Jan 18, 2008 1:36 am
Posts: 3549
Location: Israel, ME
If the queries are static, you can use the MySQL event scheduler instead -


Top
 Profile  
 
 Post subject: Re: PHP cronjob
PostPosted: Tue May 12, 2009 6:27 pm 
Offline
Forum Contributor

Joined: Sun May 03, 2009 11:39 am
Posts: 103
If you do have access to cron tab then the following URL will prove useful as it will walk you through creating the cron job from start to finish

http://www.astahost.com/info.php/Cron-J ... t2324.html


Top
 Profile  
 
 Post subject: Re: PHP cronjob
PostPosted: Wed May 13, 2009 7:13 am 
Offline
Forum Contributor

Joined: Tue Jun 17, 2008 8:12 pm
Posts: 221
Thanks, mate!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group