Reload of Apache configuration kills all php-cgi processes - is it normal and how can be avoided?


Recently I discovered that reload of Apache’s configuration, which happens every time when a new virtual server is installed or removed, kills all php-cgi processes for all virtual servers.

This is very undesirable behavior, because some of these processes are actually running scripts, which are getting killed and the users receives “The server closed the connection without sending any data” error.

Is this normal? Can this be avoided?

The server is running:
CentOS Linux 5.8
Virtualmin version 3.95.gpl
PHP 5.2.17 from the bleeding edge repository
mod_fcgid.i386 2.2-11.el5

All the virtual servers run under mod-fcgid mode.

Thank you for your time!

Mmh, I guess the PHP processes aren’t supposed to be permanently running scripts which never must be interrupted. Virtualmin should use a graceful-restart method to reload Apache’s config, which should give the PHP processes some time to finish their current task, before instructing them to restart.

Restarting them probably cannot be avoided, since they need to potentially fetch new configuration, which for some options can only be done upon their startup.

What kind of scripts are those that throw errors at the user when the process is interrupted?


You may also want to verify that it’s really doing a graceful restart… when using that, Apache should wait until all connections are closed before restarting it.

If it’s doing a hard restart, it would ignore existing connections and just restart.

You can check that in Webmin -> Servers -> Apache -> Module Config -> System Configuration -> Command to apply configuration.