Apache Crash Recovery

Posted: 2013-11-01 00:29:18

Automatically Restart Apache

If Apache crashes and does not restart by itself, you can make Windows restart it automatically.

Use Windows’ Service Recovery abilities to restart Apache on each crash…

Click the Services button in WampDeveloper’s System Tab, select the Apache Service (double-click it), in its Properties go to the Recovery tab, select to restart this service on each crash:

First failure: Restart the Service
Second failure: Restart the Service
Subsequent failures: Take No Action

Reset fail count after: 1 (days)

Everything else should be de-selected.

“Service Recovery” only works when the service exits unexpectedly, otherwise this won’t work.

Note that when Apache exits with status code 255, it restarts automatically without having to have Windows Services Manager restart it:

> [Sun Oct 30 13:28:15 2013] [notice] Parent: child process exited with status 255 -- Restarting.
> [Sun Oct 30 13:28:16 2013] [notice] Apache/2.2.20 (Win32) mod_ssl/2.2.20 OpenSSL/0.9.8r configured -- resuming normal operations

WampDeveloper’s Apache log file:

PHP Extensions

If you experience Apache crashing every couple of days, try disabling the APC or eAccelerator PHP opcode module…

Edit file:

Near the end, comment out the entire “[APC]” or “[eAccelerator]” section by inserting a “;” at the beginning of each line in that section.

Save file. Restart Apache.

Also do the same for XDebug and any other PHP extensions listed at the end of php.ini.

Apache Settings

Edit file:

Comment out this line (add a # infront)-

ThreadStackSize 4194304

Apache’s default ThreadStack size is very low on Windows (1MB or less), and is 8MB on Linux. WampDeveloper attempts to set this to 4MB as some webapps and PHP scripts that where developed on Linux assume too much and might require additional memory.

Other times a large value here can have consequences that will result in Apache segmentation faults when a webapp (such as WordPress) starts to receive moderate amounts of connections/traffic.