Topic: Unable to get php-fpm to work with nginx on CentOS 6

Hello,

I'm trying to use your latest php-fpm package in conjunction with the EPEL version of nginx on a minimal install CentOS6.

I've installed everything, setup everything, but php-fpm is not processing php files and simply returns "no input file specified".

For /etc/php-fpm.conf I did not change anything, but I adjusted /etc/php-fpm.d/www.conf to have
user=nginx
group=nginx

For /etc/php.ini I added date.timezone and cgi.fix_pathinfo=0

My /etc/nginx/nginx.conf is:

user nginx nginx;
worker_processes 1;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
   worker_connections 1024;
}

http {
   include /etc/nginx/mime.types;
   default_type application/octet-stream;
   keepalive_timeout 65;

   server {
      listen 80;
      server_name _;
      root /var/www/public;
      index index.php index.html;
      location ~* \.php$ {
         try_files $uri =404;
         fastcgi_split_path_info ^(.+\.php)(.*)$;
         fastcgi_pass 127.0.0.1:9000;
         fastcgi_index index.php;
         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
         include /etc/nginx/fastcgi_params;
      }
}

I know PHP-FPM listening on 127.0.0.1:9000 is getting called when I go to the url, but it seems no matter what I do to set fastcgi_param SCRIPT_FILENAME, PHP-FPM is not recognising it as an input path?.

If you can shed some light into this, it would be great. I am wondering whether perhaps PHP-FPM is not looking for SCRIPT_FILENAME but something else.

Regards,
Ronald

Re: Unable to get php-fpm to work with nginx on CentOS 6

Some time ago, I have wrote:
http://blog.famillecollet.com/post/2010 … -and-NGINX

My test was on fedora, probably with and older version of nginx.
I will try again with current version in fedora/epel6

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: Unable to get php-fpm to work with nginx on CentOS 6

Every time I reinstall PHP I have to change the location in /etc/php-fpm.d/www.conf 
For the socket..
listen = /var/run/php5-fpm.socket


Then in nginx configuration file.

location ~ \.php$ {
        #    root           html;
                  fastcgi_ignore_headers  Cache-Control  Expires;
                  fastcgi_pass unix:/var/run/php5-fpm.socket;
                  fastcgi_index  index.php;

Not sure if that is the problem but you may want to check that.

Re: Unable to get php-fpm to work with nginx on CentOS 6

Just an update to this, I've switched nginx to the "official nginx repo" (http://wiki.nginx.org/Install) for CentOS rather than EPEL and have since made it work with the same configuration.

Regards