I have a CentOS 7 server running Apache 2.4.6 with Event MPM and php-fpm version 5.6.10 (from REMI repo). Here's the relevant Apache config to send requests to php-fpm within the vhost (it's the only site on this server):
<FilesMatch \.php$>
SetHandler "proxy:unix:/var/run/php-fpm/www.sock|fcgi://localhost"
</FilesMatch>
Here's the relevant php-fpm pool conf:
listen = /var/run/php-fpm/www.sock
listen.owner = apache
listen.group = apache
pm = static
pm.max_children = 50
pm.max_requests = 0
Here's the php-opcache config (the default installation config):
zend_extension=opcache.so
opcache.enable=1
opcache.memory_consumption=128
opcache.max_accelerated_files=4000
opcache.blacklist_filename=/etc/php.d/opcache*.blacklist
My problem: Whenever I install and enable php-opcache, the following errors start appearing in my error log:
[Thu Jun 18 08:10:58.499871 2015] [mpm_event:debug] [pid 16546:tid 139798115227392] event.c(986): (104)Connection reset by peer: [client 157.55.39.233:15962] AH00470: network write failure in core output filter
[Thu Jun 18 08:10:58.527424 2015] [mpm_event:debug] [pid 16546:tid 139797922195200] event.c(986): (103)Software caused connection abort: [client 157.55.39.233:15990] AH00470: network write failure in core output filter
If I remove php-opcache, the errors cease. Users are reporting a 502 Service Unavailable error on the frontend whenever this occurs.
I've literally spent at least 6 hours trying to Google and find solutions. Someone said that opcache's fastshutdown
option was a problem, but that's disabled in the default config. I changed the php-fpm process management method to static with no recycling (max_requests=0), but that did not change anything either. I also tried using TCP proxy method with Apache (instead of sockets), and that also had no affect.
I'm not sure if this is relevant or not, but regardless if php-opcache is installed or not, I get the following errors reported in the error log (but at a much smaller frequency, <0.5% of all traffic, which may be a separate issue):
[Thu Jun 18 08:32:37.223430 2015] [proxy_fcgi:error] [pid 19187:tid 140598765840128] [client 37.46.115.238:55624] AH01068: Got bogus version 10, referer: ...
[Thu Jun 18 08:32:37.223462 2015] [proxy_fcgi:error] [pid 19187:tid 140598765840128] (22)Invalid argument: [client 37.46.115.238:55624] AH01075: Error dispatching request to :, referer: ...
This issue is very similar to this one, although that person is using ProxyPassMatch with TCP method, which I am not (because is bypasses .htaccess).
Anyone have any ideas that I haven't already mentioned?