Welcome! Log In Create A New Profile


[PHP] apache vhost's proxying to php-fpm hangs

Posted by Nikolaos Milas 
Nikolaos Milas
[PHP] apache vhost's proxying to php-fpm hangs
August 09, 2017 09:00PM

I am running httpd-2.4.6-45.el7.centos.x86_64 with
php-fpm-7.0.22-1.el7.remi.x86_64 (on CentOS 7).

My main problem: On this httpd server I have several vhosts running, but
apparently I am facing problems with php-fpm communication on only one
of them.

(All vhost configurations on the server are quite similar.)

Most of the sites are WordPress or Joomla Applications (running with
mysql). Everything seems right: low load, all websites are operating
fine, except this one, intermittently in the past, now almost continuously.

When the problem starts, the users receive "503 Service Unavailable"
pages for many hours/days, and in the error log I see only such errors
(logged by apache):

[Tue Aug 08 08:27:31.742640 2017] [proxy_fcgi:debug] [pid 29259]
mod_proxy_fcgi.c(963): [client] AH01076: url:
proxyname: (null) proxyport: 0
[Tue Aug 08 08:27:31.742642 2017] [proxy_fcgi:debug] [pid 29259]
mod_proxy_fcgi.c(970): [client] AH01078: serving
URL fcgi://
[Tue Aug 08 08:27:31.742645 2017] [proxy:debug] [pid 29259]
proxy_util.c(2203): AH00942: FCGI: has acquired connection for (*)
[Tue Aug 08 08:27:31.742661 2017] [proxy:debug] [pid 29259]
proxy_util.c(2256): [client] AH00944: connecting
fcgi:// to
[Tue Aug 08 08:27:31.742690 2017] [proxy:debug] [pid 29259]
proxy_util.c(2422): [client] AH00947: connected
/var/webs/wwwgreekgeo/www/wp/index.php to
[Tue Aug 08 08:27:31.742739 2017] [proxy:debug] [pid 29259]
proxy_util.c(2798): AH02824: FCGI: connection established with (*)
[Tue Aug 08 08:27:52.347960 2017] [proxy_fcgi:error] [pid 29259]
(104)Connection reset by peer: [client] AH01075:
Error dispatching request to :
[Tue Aug 08 08:27:52.348021 2017] [proxy:debug] [pid 29259]
proxy_util.c(2218): AH00943: FCGI: has released connection for (*)

The problem is NOT resolved by restarting apache and/or php-fpm.

The config of the vhost is as follows:

<VirtualHost *:80>
DocumentRoot "/var/webs/wwwgreekgeo/www"

ServerName www.greekgeo.noa.gr

ServerAdmin webmaster@noa.gr

DirectoryIndex index.php index.html index.htm

Redirect 301 /en.index.html http://www.greekgeo.noa.gr/wp/

RewriteEngine on

RedirectMatch ^/index.html$ /wp/

<Directory "/var/webs/wwwgreekgeo/www">
Options -Indexes +FollowSymLinks
AllowOverride All
Require all granted

<Files ~ "^\.ht">
Require all denied

<FilesMatch \.php$>
SetHandler "proxy:fcgi://"

ErrorLog /var/webs/wwwgreekgeo/log/error_log
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\"
\"%{User-agent}i\"" combined
CustomLog /var/webs/wwwgreekgeo/log/access_log combined
LogLevel debug


I've also followed these directions to enable Wordpress php logging:

For your reference, I am also including the php-fpm configuration:

# cat /etc/php-fpm.d/www.conf


user = apache
group = apache

listen =
listen.allowed_clients =

pm = dynamic
pm.max_children = 50
pm.start_servers = 2
pm.min_spare_servers = 2
pm.max_spare_servers = 4
pm.process_idle_timeout = 10s;
pm.max_requests = 500
pm.status_path = /fpm-status

slowlog = /var/log/php-fpm/www-slow.log
request_slowlog_timeout = 5s
request_terminate_timeout = 20s

catch_workers_output = yes

security.limit_extensions = .php .php3 .php4 .php5 .php7 .htm .html

php_admin_value[error_log] = /var/log/php-fpm/www-error.log
php_admin_flag[log_errors] = on
php_admin_value[error_reporting] = 32767
php_value[session.save_handler] = files
php_value[session.save_path] = /var/lib/php/session
php_value[soap.wsdl_cache_dir] = /var/lib/php/wsdlcache

php_admin_value[post_max_size] = 40M
php_admin_value[short_open_tag] = On

php_value[date.timezone] = "Europe/Athens"

While searching in php-fpm log file (/var/log/php-fpm/www-error.log) I
only found two PHP records about this website in two weeks, with the
following content:

[08-Aug-2017 05:11:45 Europe/Athens] PHP Fatal error: Uncaught Error:
Call to undefined function get_header() in
Stack trace:
#0 {main}
thrown in
/var/webs/wwwgreekgeo/www/wp/wp-content/themes/nirvana/404.php on line 10
[08-Aug-2017 05:11:45 Europe/Athens] PHP Fatal error: Uncaught Error:
Call to undefined function get_header() in
Stack trace:
#0 {main}
thrown in
/var/webs/wwwgreekgeo/www/wp/wp-content/themes/nirvana/404.php on line 10

It appears as a single entry recorded twice (for some unknown reason).

So, even this one (double) entry means that THERE IS (at least some) PHP
logging about this website!

But there are many questions:

- Why there is only one error entry about this website (in two weeks)?
- Why is it double?
- Why there is nothing else (PHP-related) logged about this website?
- Why no other debugging info is being logged?
- Could php-fpm somehow be "blacklisting" the website PHP application
(WordPress) due to this (and possible other) errors?

In essence, why is this vhost's php-fpm communication hanging without
any errors logged by php-fpm?

Any ideas?

Please, help me to find out how to troubleshoot further.

If you can't help, please let me whom I should contact to get some
efficient help (mailing list, forum etc.)

Thanks in advance,

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Sorry, only registered users may post in this forum.

Click here to login