Posted: Wed Aug 15, 2007 8:45 pm
Well, if going by the above post.. you wouldn't need two scripts.
Of course there is a problem here. If the server shuts off or apache stops running or many other things.. the script will not be executing. It should be performed as a cron job.
A cron job is a task that the server does automatically (without anyone visiting a page). A lot of control panels offer an interface to cron, making it easy to set up a cron.
Yours might look like this
In the first part of that, /usr/bin/php is the path (or changed to the path) of php on your server. The second part is the location of the script you want to be ran automatically.
You can set your cronjobs to run every second, every minute, hour, day, etc etc etc... any time you want.
Code: Select all
ignore_user_abort(true);
set_time_limit(0);
while(true)
{
//actions here
sleep(100); // or how many ever seconds you want the script to be halted for
}A cron job is a task that the server does automatically (without anyone visiting a page). A lot of control panels offer an interface to cron, making it easy to set up a cron.
Yours might look like this
Code: Select all
/usr/bin/php /home/myaccount/public_html/my_script.phpYou can set your cronjobs to run every second, every minute, hour, day, etc etc etc... any time you want.