Fix Various Apache crashes on Windows

Some random crashes you may face on your Windows development machine.

1. Apache keep crashing every few hundred requests

In Apache error.log:

 AH00428: Parent: child process 6096 exited with status 3221226356 — Restarting.

Reason:

Apache’s default stack size is too small

Solution:

Add the following setting to httpd.conf

<IfModule mpm_winnt_module>
   ThreadStackSize 8388608
</IfModule>

Reference: http://www.codexpedia.com/apache-server/parent-child-process-exited-with-status-3221225725-restarting-on-xamp-apache/

Alternative Workaround: Use fastcgi instead of Apache module:

See: https://blog.tiger-workshop.com/wamp-development-machine-setup-note/

2. Apache random stop responding with Internet Explorer

Reason:

VMWare/VirtualBox network driver do not handle AcceptEx() correctly

Solution:

Add the following setting to httpd.conf

AcceptFilter https none 
AcceptFilter http none 
EnableSendfile Off 
EnableMMAP off

Reference: https://stijndewitt.com/2014/01/10/apache-hangs-ie11/

3. Apache still crashing with status 3221226356

Windows + PHP as Apache module is affected by this and other bugs that cause problems.
Switch to PHP as FCGI setup solve many problems, especially for server running Laravel.

1. Download a “non-thread safe” version of PHP

2. Create C:\Apache\conf\extra\httpd-php7.conf

LoadModule fcgid_module modules/mod_fcgid.so

<IfModule fcgid_module>
   FcgidMaxProcesses 300
   FcgidMaxProcessesPerClass 300

   FcgidOutputBufferSize 65536
   FcgidConnectTimeout 10
   FcgidProcessLifeTime 0
   FcgidMaxRequestsPerProcess 0
   FcgidMinProcessesPerClass 0
   FcgidFixPathinfo 0
   FcgidProcessLifeTime 0
   FcgidZombieScanInterval 20
   FcgidMaxRequestLen 536870912
   FcgidIOTimeout 120
   FcgidTimeScore 3

   FcgidPassHeader Authorization

   FcgidInitialEnv PHPRC "C:\\PHP"
   FcgidInitialEnv PATH "C:\\PHP;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;"
   FcgidInitialEnv SystemRoot "C:\\Windows"
   FcgidInitialEnv SystemDrive "C:"
   FcgidInitialEnv TEMP "C:\\WINDOWS\\TEMP"
   FcgidInitialEnv TMP "C:\\WINDOWS\\TEMP"
   FcgidInitialEnv windir "C:\\WINDOWS"

   DirectoryIndex index.html index.htm index.php

   <Files ~ "\.php$">
      Options Indexes FollowSymLinks ExecCGI
      AddHandler fcgid-script .php
      FcgidWrapper "C:/PHP/php-cgi.exe" .php
   </Files>
</IfModule>

Edit C:\Apache\conf\httpd.conf, Add

# PHP7
Include conf/extra/httpd-php7.conf

4. Still Crash?

Reinstall a PROPER WAMP stack following this guide.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.