6

I have multiple virtual webs running Wordpress but this one started to throw errors and I am unable to find the problem.

Apache says:

[Tue Jul 30 14:13:40 2013] [error] [client 82.100.0.70] FastCGI: comm with server "/var/www/uzivatel/www.domena.xy.php5-fcgi" aborted: idle timeout (30 sec)
[Tue Jul 30 14:13:40 2013] [error] [client 82.100.0.70] FastCGI: incomplete headers (0 bytes) received from server "/var/www/uzivatel/www.domena.xy.php5-fcgi" 

But PHP-FPM log is ok (it is generated in some miliseconds after the request):

- -  30/Jul/2013:14:13:10 +0200 "GET /index.php" 200 /var/www/uzivatel/webs/www.domena.xy/index.php 793.871 35072 37.79/30.23

There is the code 200 so the page seems to be created correctly but Apache behaves like no reply came from fastcgi server.

But the interesting part is, when I cut the page generation before , the apache returns it correctly to the client. But If I insert the <?php die(); ?> after the tag, the same error happens.

Is there a way how can I debug communication between apache and the fastcgi server?

Here is the config (the same configuration is ok for another virtual webs):

<VirtualHost 1.2.3.4:80>

    ServerName www.domena.xy
    DocumentRoot /var/www/uzivatel/webs/www.domena.xy/
    FastCgiExternalServer /var/www/uzivatel/www.domena.xy.php5-fcgi -socket /tmp/php-fpm/php-www.domena.xy.socket -pass-header Authorization
    Action php5-fcgi /php5-fcgi
    Alias /php5-fcgi /var/www/uzivatel/www.domena.xy.php5-fcgi
    AddHandler php5-fcgi .php

    <Directory "/var/www/uzivatel/webs/www.domena.xy/">
        Options ExecCGI FollowSymLinks
        Order Allow,Deny
        Allow From all
    </Directory>


</VirtualHost>


<VirtualHost 1.2.3.4:80>
   ServerName domena.xy
   RedirectPermanent / http://www.domena.xy/
</VirtualHost> 

and the PHP-FPM:

[www.domena.xy]
user = uzivatel
group = uzivatel
listen = /tmp/php-fpm/php-www.domena.xy.socket
listen.owner = uzivatel
listen.group = uzivatel
listen.mode = 0660
pm = ondemand
pm.max_children = 5
pm.process_idle_timeout = 300s
pm.max_requests = 1000
access.log = /var/www/uzivatel/.log/$pool.php-fpm.log
access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C/%{user}C"
slowlog = log/$pool.log.slow
;request_slowlog_timeout = 0
request_terminate_timeout = 600
rlimit_files = 500
security.limit_extensions = .php .php3 .php4 .php5

php_admin_value[memory_limit] = 64M
php_admin_value[open_basedir] = /var/www/uzivatel/.tmp/:/var/www/uzivatel/webs/www.domena.xy/
php_admin_value[upload_tmp_dir] = /var/www/uzivatel/.tmp/
php_value[session.save_path] = /var/www/uzivatel/.sessions/www.domena.xy/
Bruce
  • 407
  • 2
  • 6
  • 13

2 Answers2

13

In the Apache vhost config, try to add the -idle-timeout parameter:

FastCgiExternalServer /var/www/uzivatel/www.domena.xy.php5-fcgi-idle-timeout 60-socket /tmp/php-fpm/php-www.domena.xy.socket -pass-header Authorization

See the documentation for further details.

tanius
  • 666
  • 7
  • 13
Widmo
  • 321
  • 2
  • 10
0

Apache might have file access permissions to write to the socket file /tmp/php-fpm/php-www.domena.xy.socket, but not to read from it.

(Side note re. permissions and PHP-FOM: while the PHP-FPM server /var/www/uzivatel/www.domena.xy.php5-fcgi does not have to exist as a file, its containing directory must exist, and Apache must have read/write permission to it.)

tanius
  • 666
  • 7
  • 13