Page 1 of 1

run php script continuously after closing browser from host

Posted: Fri Feb 03, 2012 10:14 pm
by dpkdn
I want to run a php script continuously even after browser is closed..... :?
actually i am inserting data into ms-sql database which happens on every 5 seconds ..
thats why i need help so that i can run that script forever even after i close browser and shutdown pc...
my script is located on a web host..under some domain.
I have used
ignore_user_abort(1); // run script in background
set_time_limit(0); and also (-1);
but then also it is running upto 30 to 40 seconds...
I dont know how to do this...


any help regarding to this is appriciated...
thanks in advance.........

Re: run php script continuously after closing browser from h

Posted: Sat Feb 04, 2012 8:41 am
by Eric!
Basically you can't do this and I don't think you would want too. If you had 1000 users you'd end up with 1000 versions of the same script running and crash your server.

You can run a php script independently of a user via a cron job. You can just configure the cron job to run at whatever time interval you want and that will start up your script automatically.