Hello
I know that PHP acts on a client request. That is the code only runs as a response.
I was wondering whether it is possible to have a PHP script which can run proactively in the server without being triggered by a client request.
Examples:
A scheduler could send mails every hour...
database cleanup could run every hour...
does anyone know if it is possible, or do I need some other server-side technology for that?
thanks
proactive scripts in PHP - is it possible?
Moderator: General Moderators
-
davidklonski
- Forum Contributor
- Posts: 128
- Joined: Mon Mar 22, 2004 4:55 pm
Depends on what operating system you intend to use.
On Windows you can simply execute 'php.exe --help' in a Dosbox to see what parameters it accepts (e.g. php -q script.php would parse and execute the script).
On Linux (probably other *ix, too) you need to build PHP as CGI-Binary; on Debian (probably other Linuces, too
) you may want to apt-get install php4-cgi. php4 is then available as normal binary like find and the like. Again, php4 --help tells you how to call it properly.
HTH
Forgot to mention that you will need some kind of scheduler to do automated stuff
PHP4 is very nice for shell-scripts indeed
On Windows you can simply execute 'php.exe --help' in a Dosbox to see what parameters it accepts (e.g. php -q script.php would parse and execute the script).
On Linux (probably other *ix, too) you need to build PHP as CGI-Binary; on Debian (probably other Linuces, too
HTH
Forgot to mention that you will need some kind of scheduler to do automated stuff
PHP4 is very nice for shell-scripts indeed