Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am following this tutorial to try to install PHP-FPM on my LAMP stack.

My config in /etc/apache2/sites-available/default contains (as per the guide)

<IfModule mod_fastcgi.c>
        Alias /php5.fastcgi /var/www/fastcgi/php5.fastcgi
        AddHandler php-script .php
        FastCGIExternalServer /var/www/fastcgi/php5.fastcgi -socket /var/run/php-fpm.sock
        Action php-script /php5.fastcgi virtual

# This part is not necessary to get it to work, but it stops anything else from being
# accessed from it by mistake or maliciously.
        <Directory "/var/www/fastcgi">
                Order allow,deny
                <Files "php5.fastcgi">
                        Order deny,allow

Which resulted in 500 errors. I checked the Apache log and am seeing:

(111)Connection refused: FastCGI: failed to connect to server "/usr/lib/cgi-bin/php5-fcgi": connect() failed FastCGIExternalServer /var/www/fastcgi/php5.fastcgi -socket /var/run/php-fpm.sock
FastCGI: incomplete headers (0 bytes) received from server "/usr/lib/cgi-bin/php5-fcgi"

I checked and realised my /etc/php5/fpm/pool.d/www.conf was listening on a different socket location (from the tutorial), so I updated the apache config to:

FastCGIExternalServer /var/www/fastcgi/php5.fastcgi -socket /var/run/php5-fpm.sock

But now visiting a php5 script just shows plain text.

I'm not sure where I'm going wrong here, can anyone point me in the right direction to troubleshooting this? Unfortunately everything I've found is very NGINX oriented (or the user just switched to NGINX entirely!) I am somewhat tied to Apache at the moment as I am relying on .htaccess for wordpress and permalink rewrites etc.

Endless thanks in advance.

share|improve this question
you find a solution to this? –  Ricalsin Apr 15 at 20:56
@Ricalsin Unfortunately not, it would be incredibly useful if I could as well... at the moment I have to do all sorts of crazy permissions to have things running properly while still being able to edit files from my own user account –  waffl Apr 16 at 12:12

1 Answer 1

Try using the parameters -idle-timeout and -appConnTimeout in the FastCgiExternalServer in the httpd.conf. Check this out for the syntax

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.