Page 1 of 1
i want to write a PHP script that run at sever start up?
Posted: Sun Feb 14, 2010 3:00 pm
by codeworks
Please i want to write a PHP script that will be accessing database at interval without human intervention. Once the script is uploaded to the web server, it should keep running until the server is shut down and when the server is up again the script should start running again.
Is this possible thanks
Re: i want to write a PHP script that run at sever start up?
Posted: Sun Feb 14, 2010 4:41 pm
by infolock
Yes, it is possible, but it is not possible with PHP alone. How you do this all depends on your server environment, ie: what server are you running (linux, windows, etc), what web server are you running (apache, iis, etc), what database server are you running (mysql, mssql, oracle, etc).
What you'll have to do is, for whatever server you are running, determine how each are started. Then, you'll have to figure out if there is a manner in which to load a script during server start, and server stop (or process start, process stop).
For linux, you could create a script that is run once you call apachectl start/stop, and then execute a PHP script from there. For IIS, you'd do a windows service. The scope and specs are for you to figure out from the vast knowledge google can give you. I hope this helps answer your question though.