You are not logged in.

#1 2014-05-20 00:34:03

phillips1012
Member
Registered: 2014-01-13
Posts: 6
Website

Extremely cryptic problem with php-fpm and nginx

I am trying to setup a php/nginx server, but all of the php pages are completely blank without any sign that an error happened. No log message is left in /var/log/php-fpm.log or /var/log/nginx/error.log. The server returns the http status code 200 as if nothing happened and the access log reflects that normally. This is what my nginx location directive looks like:

        location ~ [^/]\.php(/|$) {
            fastcgi_split_path_info ^(.+?\.php)(/.*)$;
            if (!-f $document_root$fastcgi_script_name) {
                return 404;
            }

            fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
            fastcgi_index index.php;
            include fastcgi_params;
        }

Things I have tried:

  • Using TCP sockets instead of unix sockets

  • Modify all the permissions (for test.php, a tiny file without any php logic)

  • Check the logs

  • Using fastcgi.conf instead of fastcgi_params (I get "No input file specified." when I try this)

Any suggestions?

Offline

#2 2014-05-20 17:09:20

Spider.007
Member
Registered: 2004-06-20
Posts: 1,175

Re: Extremely cryptic problem with php-fpm and nginx

If there are no errors; tell us what your access-logs tell. Enable them in fpm and tell us if the request ends up there. Also; nginx can also log the upstream ip-address; if you add that to the access-logs you'll at least know if the problem is nginx, or fpm

Offline

#3 2014-05-20 17:56:45

rune0077
Member
Registered: 2009-04-11
Posts: 135

Re: Extremely cryptic problem with php-fpm and nginx

Offline

#4 2014-05-20 20:20:58

phillips1012
Member
Registered: 2014-01-13
Posts: 6
Website

Re: Extremely cryptic problem with php-fpm and nginx


That isn't exactly my problem. The server responds with no body (so no blank html document)

root@server ~# curl -vH "Host: ███████" localhost/test.php
* Hostname was NOT found in DNS cache
*   Trying ::1...
* connect to ::1 port 80 failed: Connection refused
*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 80 (#0)
> GET /test.php HTTP/1.1
> User-Agent: curl/7.36.0
> Accept: */*
> Host: ███████████
> 
< HTTP/1.1 200 OK
* Server nginx/1.6.0 is not blacklisted
< Server: nginx/1.6.0
< Date: Tue, 20 May 2014 20:11:02 GMT
< Content-Type: text/html
< Transfer-Encoding: chunked
< Connection: keep-alive
< Vary: Accept-Encoding
< 
* Connection #0 to host localhost left intact

When I do set SCRIPT_FILENAME to $document_root$fastcgi_script_name, it responds with "No input file specified."

Spider.007 wrote:

If there are no errors; tell us what your access-logs tell. Enable them in fpm and tell us if the request ends up there. Also; nginx can also log the upstream ip-address; if you add that to the access-logs you'll at least know if the problem is nginx, or fpm

The nginx log message:

127.0.0.1 - - [20/May/2014:14:15:50 -0600] "GET /test.php HTTP/1.1" 200 5 "-" "curl/7.36.0"

I'll try to find a way to make php-fpm more verbose and I'll edit this post with the error when I do. At the moment it's only logging startups/shutdowns.

Last edited by phillips1012 (2014-05-20 20:23:40)

Offline

#5 2014-05-20 22:06:15

rune0077
Member
Registered: 2009-04-11
Posts: 135

Re: Extremely cryptic problem with php-fpm and nginx

Where have you defined your document root? It should be defined in the server block, otherwise php location block won't know about it, and it will return the "no input file specified" response.

Offline

#6 2014-05-20 23:26:21

phillips1012
Member
Registered: 2014-01-13
Posts: 6
Website

Re: Extremely cryptic problem with php-fpm and nginx

rune0077 wrote:

Where have you defined your document root? It should be defined in the server block, otherwise php location block won't know about it, and it will return the "no input file specified" response.


Hmm... it seems all it needed was an absolute path for the document root and defining SCRIPT_LOCATION. I guess the fcgi module doesn't convert it to an absolute path for some reason.

Offline

Board footer

Powered by FluxBB