I have written a php page to update my database with data from files and i want to have this script to be called every 5 seconds. How can I do this?
Is it possible to schedule this call on the server? And how?
I do have full root access to the server so I should have all possiblilities to do this.
check out sleep() function
=---------show.php
...
.
..
.
sleep(4);
header("Location:show.php");
=--------------------
give the same page name in location header
Important question: Why would you want something run every 5 seconds? Why not just run the program, and let it run. And then let the program operate every 5 seconds?
It would be better if you explained what you are trying to do, rather than have us try to help you put together a solution that may be the wrong solution.
Example of why this is bad. You hire someone to build you a table. They build you a table. But what you really needed was 6 chairs. Sure, they can help you build a great table, but it doesn't solve the real problem: that problem being seating.
If you got 2 users/h, why update the database making the server work for nothing? Adding an "update table..." in the beginning of the sites backend could help, but if you got 1000's of visits/min, you get high loads.
Workaround could be to increase a value on each visit, and when it hits a certain amout (or a certain time()-(time()-5) has passed, do the update.