Apache too many child process - mpm_event caught SIGTERM shutting down

Solution 1:

Many factors can lead to Apache restarting or shutting down. To dig a bit deeper, you can run these commands then follow the bread crumbs.

cat /var/log/messages | grep apache

cat /var/log/syslog | grep apache

cat /var/log/messages | grep kill

If you have multiple sites running (sites-available) with their own error logs, it would also be prudent to check each one's error log to ensure help narrow down any issues. This is necessary because Apache could be doing a graceful restart, and upon restarting, a site config could be causing a fatal error that is will not show in system logs.

If they are not already, make sure error logging is on for all sites.

Also, although obvious, make sure you are updated. Plugin version issues can often cause Apache to crash or fail to restart.

sudo apt-get update && sudo apt-get upgrade -y

Always check your global and site configs with this command. Especially 000-default.conf, apache2.conf, and ports.conf.

sudo apachectl configtest

Ensure that this command does not return an error as well.

apache2ctl restart 

If you have the patience and the ability, you can also try disabling mod one at a time. Start with ones like mod_fastcgi, rewrite, and anything SSL related as they are common culprits.

SIGTERM is used to restart Apache and is worth reading up on if you get this far without a solution (assuming its setup in init to auto-restart): http://httpd.apache.org/docs/2.2/stopping.html

As a last resort, a clean install of Apache and PHP will likely clear out the issue. I highly recommend using docker / docker-compose to run your stack if you can. It makes keeping your apache, PHP, and database updated a very painless process.