Making sure PHP-CGI is running (on Windows Server)
I recently had the pleasure of setting up a very old Windows 2003 server with Nginx and PHP-CGI. It works very well, and can serve a heap of concurrent clients with no problems, but every now and then, PHP-CGI terminates, which is a bit of bother. Here's a way of keeping a tab on it.
You obviously don't want to sit around paying attention to the system and restarting PHP-CGI manually, so here's a quick way of checking whether it's running, and start the process if it has been terminated. Permalink for this article http://mirror.magicode.org/content/Making_sure_PHPCGI_is_running_on_windows
This text was originally written for http://blog.magicode.org
Save and run this bat-file as a cronjob on Windows (forget Scheduler, you need something that can run every minute) and you're set. Change the port for PHP if you're using something else than 9090 (9000 is the default for Nginx). If you see this notice on any site other than magicode.org, it's probably been lifted without consent
You've probably noticed that I'm executing a file called RunHiddenConsole.exe. This is a very small utility that will let you start any command silently. RunHiddenConsole.exe is freeware and open source, and is available here. There are many cron-like programs for Windows, I've had success with a freeware program called pycron.
