Hello everyone!
I'm looking for a php code that set apache server to autoexecute a file (for example: example.php) every 12 hours.
My idea is to make that file maintained update a central mysql db every an elapsed time.
The example.php file don't will return HTML code, it will have only php code that will be execute on the server to check a db information of another's hosts.
Thanks for all!
Juani.
How to make Apache autoexecute a PHP file?
Moderator: General Moderators
-
juanirecla
- Forum Newbie
- Posts: 8
- Joined: Wed May 25, 2005 9:47 pm
-
Bennettman
- Forum Contributor
- Posts: 130
- Joined: Sat Jun 15, 2002 3:58 pm
An alternative option if you don't want to use cron (if it's related to something like a forum or gets visited regularly, and you don't need it to run at exactly the right time), is to have a value in text file or DB with the time it's next scheduled to run, then whenever someone visits have the script check that value against the current time. If it's in the past, run the script (exec typically) and increment the next-run time.
-
juanirecla
- Forum Newbie
- Posts: 8
- Joined: Wed May 25, 2005 9:47 pm
Thankss!! Yes, but I don't want to delay the first consult wile the db is updated. . .
Is dificult to configure the cron? I have to say it to de hostmaster to do it? Because I imagine I don't have enought permisions to access to that part of the server. .
There's any way to configure it using php functions?
Thanks again!!
Juani.
Is dificult to configure the cron? I have to say it to de hostmaster to do it? Because I imagine I don't have enought permisions to access to that part of the server. .
There's any way to configure it using php functions?
Thanks again!!
Juani.