I set up a very small local network for web development. The webserver is a stack of
- MySql 5.1.37
- NGINX 0.8.19
- PHP 5.2.10 with w/ Suhosin-Patch 0.9.7 and Xdebug v2.0.4
The server itself runs ubuntu karmic 9.10.
In order to provide PHP to NGINX I use the following command:
sudo /usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -u www-data -g www-data -f /usr/bin/php5-cgi -P /var/run/fastcgi-php.pid
My problem is that every morning, when the machine resumes from a suspend state PHP has stopped working (in the browser NGINX display a "bad gateway" message after a few seconds of trying to load the requested page). If I try to relaunch the command for respawning PHP, it gives me error, saying that the address is already in use.
EDIT: more information
After having spawned, if I run
ps ax | grep php I get a
php-cgi process running, while if I re-issue the command after resuming from suspend, I do not get anything, although the address would still result to be "in use" if I try to re-spawn. The idea that is crossing my mind is that php-cgi registers its presence with some other process, that does not detect the sudden death php-cgi with the suspend, keeping the address busy. Can it be?!
Any idea on how to fix this? An elegant solution is most welcome, but even a dirty workaround that makes possible for the server to self-recovery without human intervention is ok. This is just an internal production server used by a couple of people.
Thank you in advance for your time!