PHP-FPM not working with nginx and CentOS

Posted by Daniel on Server Fault See other posts from Server Fault or by Daniel
Published on 2012-06-01T20:00:09Z Indexed on 2012/06/03 4:43 UTC
Read the original article Hit count: 459

Filed under:
|
|

After failing to get FastCGI to work with PHP I have installed the PHP-FPM service which is reported to work out of the box, however PHP files are downloading instead of executing.

This is what I have in the nginx.conf file:

server {
    listen 80;
    server_name  pubserver;
    root         /usr/share/nginx/html;
    location ~ \.php$ {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
        fastcgi_param  PATH_INFO $fastcgi_script_name;
        include        /etc/nginx/fastcgi_params;
    }
}

The command netstat -tulpn | grep :9000 displays this which suggests PHP-FPM is running:

tcp        0      0 127.0.0.1:9000              0.0.0.0:*                   LISTEN      1058/php-fpm.conf)

© Server Fault or respective owner

Related posts about centos

Related posts about nginx