-->

Apache FastCGI server connection failure

2019-09-16 21:07发布

问题:

I have a virtual machine base box for Debian wheezy that I've been using with vagrant for the last few months without any issues, however yesterday when I brought up a new machine and updated/upgraded packages I started getting a FastCGI server connection failure error:

[Wed Jun 04 14:39:03 2014] [error] [client 10.0.2.2] (13)Permission denied: FastCGI: failed to connect to server "/vagrant/php5-fcgi": connect() failed
[Wed Jun 04 14:39:03 2014] [error] [client 10.0.2.2] FastCGI: incomplete headers (0 bytes) received from server "/vagrant/php5-fcgi"

I am able to resolve the issue temporarily by manually touching and chmodding /tmp/php5-fpm-vagrant.sock, but my question is why did it start happening all of a sudden?

Personal preferences aside, is there anything functionally wrong with my configuration?:

In my apache sites available I have a file called 000php containing:

FastCgiExternalServer /vagrant/php5-fcgi -socket /tmp/php5-fpm-vagrant.sock -pass-header Authorization

Since apache loads sites alphabetically, this always gets loaded first, then I have another file called vagrant that contains:

<VirtualHost *:80 *:8080>
   DocumentRoot /vagrant/public_html/
   ServerName vagrant.localhost

   <Directory /vagrant/>
      AllowOverride all
   </Directory>

   AddHandler php5-fcgi .php
   Action php5-fcgi /php5-fcgi
   Alias /php5-fcgi /vagrant/php5-fcgi

   ErrorLog ${APACHE_LOG_DIR}/vagrant_error.log
   CustomLog ${APACHE_LOG_DIR}/vagrant_access.log combined
</VirtualHost>

and a php fpm pool config called vagrant.conf that looks like this:

[vagrant]
listen = /tmp/php5-fpm-vagrant.sock

listen.allowed_clients = 127.0.0.1

user = vagrant
group = vagrant

pm = ondemand
pm.max_children = 50

any suggestions would be greatly appreciated

回答1:

Figured out the answer, this was caused by https://bugs.php.net/bug.php?id=67060

The fix was to add the following lines to my vagrant.conf php fpm configuration file and restart php fpm, a reload was not enough

listen.owner = www-data
listen.group = www-data
listen.mode = 0660