Hello,
I have a dedicated server running Cent OS with a Parallel PLESK panel. I need to run a php script every second, that updates my database. These is no alternative way timewise, i have checked every method, it needs to be updated every second.
I can find my script using the url: http://www.mysite.com/phpfile.php?key=123, and this has to be executed every second.
Does anyone have any knowledge at all on doing this, i can not seem to find the answer.
I heard about doing it with CLI and putty, but i have no knowledge of this at all. Or can this be done using the PLESK Panel?
And can the file be executed locally every second. Like \phpfile.php
If someone helps me on answering these question i would really appreciate it.
Regards
EDIT
It has been a few months since i added this question. I ended up using the following code:
#!/user/bin/php
$start = microtime(true);
set_time_limit(60);
for (i = 0; i < 59; ++$i) {
doMyThings();
time_sleep_until($start + $i + 1);
}
Thank you for this code guys!
My cronjob is set to every minute. I have been running this for some time now in a test environment, and this works out great. It works really supperfast, and i see no increase in CPU nor Memory usage.