8

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
user9517
  • 115,471
  • 20
  • 215
  • 297
  • 2
    You should answer your own question and mark it as an accepted answer to make this question looks like a solved one – regilero May 29 '12 at 12:13

3 Answers3

2

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
user9517
  • 115,471
  • 20
  • 215
  • 297
  • Are you sure that problem is in mod_deflate? Any references? Looks very strange... – GioMac Aug 26 '12 at 19:17
  • @GioMac: I've no idea - the OP says that's what solved the problem in the question. I just put it in an answer. Note that SO sent it to us and it was originally answered on March 9th 2012. – user9517 Aug 26 '12 at 19:27
0

I can confirm the above solution worked for me but I had to fix my ProxyPassmatch settings as well.

Old config

<IfModule proxy_module>
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/home/YOURDOMAIN/public_html/$1
</IfModule>

New config - different rewrite filter, plus code from above

<IfModule proxy_module>
ProxyPassMatch ^(.*\.php)$ fcgi://127.0.0.1:9000/home/YOURDOMAIN/public_html/$1
</IfModule>

<IfModule mod_deflate.c>
SetOutputFilter DEFLATE
...code from above
</IfModule>
Alauddin
  • 103
  • 2
0

The problem here is that the response from phpList doesn’t fill a full package. php-fpm breaks off connection with Apache prematurely if its response doesn’t fill at least one buffer. As a work-around you can switch to mod_php temporarily or pad out the response with some randomly generated text.

Daniel
  • 211
  • 3
  • 16