Php – Apache + PHP-FPM = random “Error parsing script headers” + Seg Faults

apache-2.4httpdPHPphp-fpm

I have PHP-FPM setup with Apache 2.4 using proxy_fcgi, all works fine, but every one in 4-6 requests, Apache returns a blank page. This happens on my main site http://danielhe.com/, but not subdomain vhosts.

This shows up Apache's error log,
[client x] AH01070: Error parsing script headers

And eventually, sometimes Apache segfaults
AH00052: child pid 9740 exit signal Segmentation fault (11)

I can reproduce the "Error parsing script headers" very easily by refreshing the page a couple times, but the seg fault happens randomly after a couple of "Error parsing script headers"

Update
I have found a fix for the seg faults, and the WSOD has apparently fixed itself.
mod_deflate has some issues, but this config from the Apache documentation fixed it

SetOutputFilter DEFLATE
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# Don't compress images
SetEnvIfNoCase Request_URI \
\.(?:gif|jpeg|jpg|png)$ no-gzip dont-vary
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary

Best Answer

The solution was to use this configuration

SetOutputFilter DEFLATE
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# Don't compress images
SetEnvIfNoCase Request_URI \
\.(?:gif|jpeg|jpg|png)$ no-gzip dont-vary
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
Related Topic