Php-fpm works with some sites but not others?

This is a weird one, and I’m turning to the mailing list as a last
resort
after searching for a few hours to no avail. Our server hosts a number
of
websites, each with an individual nginx config file. We recently had to
replace the hdd, so I backed everything up and reinstalled on the new
hardware. I got php-fpm running again and started to add back sites.
Everything was working perfectly, until for some reason one site just
failed to show anything.

I made sure the permissions were correct, and the nginx config file
hasn’t
changed. One bizarre thing is that a call to phpinfo() returns “File not
found”, but I can’t seem to find a fix for this online. It also doesn’t
explain why phpinfo() works perfectly on about 4 other sites. Has anyone
come across this error before?

On Mon, May 28, 2012 at 11:07 PM, Adrian H. [email protected]
wrote:

I made sure the permissions were correct, and the nginx config file hasn’t
changed. One bizarre thing is that a call to phpinfo() returns “File not
found”, but I can’t seem to find a fix for this online. It also doesn’t
explain why phpinfo() works perfectly on about 4 other sites. Has anyone
come across this error before?

Yes.

Was kinda hoping for a solution…lol.

On Mon, May 28, 2012 at 11:13 PM, Adrian H. [email protected]
wrote:

Was kinda hoping for a solution…lol.

Fix the config.

On Mon, May 28, 2012 at 11:22 PM, Adrian H. [email protected]
wrote:

Seriously? You think I haven’t tried that? My issue is that the config
works for some sites, and then fails for another. There are no differences
between the config files other than the names used. This was all working
before on my other server, and all I did was copy the files across.

So which part of the config do you think I need to fix?

Too bad I don’t have clairvoyance therefore I can’t help you on this
one.

You said you’ve seen the error before. What was causing it that time? Do
you want me to send a copy of my config, if so, which one? You don’t
have
to be clairvoyant; just tell me which files you need to look at.

Seriously? You think I haven’t tried that? My issue is that the config
works for some sites, and then fails for another. There are no
differences between the config files other than the names used. This was
all working before on my other server, and all I did was copy the files
across.

So which part of the config do you think I need to fix?

On Mon, May 28, 2012 at 11:36 PM, Adrian H. [email protected]
wrote:

You said you’ve seen the error before. What was causing it that time?

Many times, ranges from incorrect file permission, incorrect service
privilege, incorrect root, incorrect alias, incorrect rewrite,
incorrect try_files, incorrect location, incorrect variable, bug, etc.

Not sure if that helps.

Do you
want me to send a copy of my config, if so, which one? You don’t have to
be clairvoyant; just tell me which files you need to look at.

I don’t even know how you set up your config… (one instance per
host? One file per host? One “set” file per host? One big file?)

On Mon, May 28, 2012 at 11:53 PM, Adrian H. [email protected]
wrote:

All permissions look correct to me.

sudo -u php_user cat /path/to/problematic/file.php

I very much doubt it is something wrong
with an alias / rewrite / try_files since this is the same config that only
a few hours ago was working perfectly well on the old install. What doesn’t
help is that there don’t appear to be any errors in the logs (i.e. nginx
logs just log 404’s rather than PHP errors, and the php-fpm error log has
just startup info, despite me turning error reporting on to the maximum).

Because that’s the error when php can’t find specified input file.
It’s never logged iirc.

server_names, etc).

“only”… “etc”. Ok.

On Mon, May 28, 2012 at 5:48 PM, Edho A. [email protected] wrote:

Many times, ranges from incorrect file permission, incorrect service
privilege, incorrect root, incorrect alias, incorrect rewrite,
incorrect try_files, incorrect location, incorrect variable, bug, etc.

Not sure if that helps.

All permissions look correct to me. I very much doubt it is something
wrong
with an alias / rewrite / try_files since this is the same config that
only
a few hours ago was working perfectly well on the old install. What
doesn’t
help is that there don’t appear to be any errors in the logs (i.e. nginx
logs just log 404’s rather than PHP errors, and the php-fpm error log
has
just startup info, despite me turning error reporting on to the
maximum).

I don’t even know how you set up your config… (one instance per
host? One file per host? One “set” file per host? One big file?)

/etc/nginx/sites-available/ ← Individual config file per host.
/etc/nginx/sites-enabled/ ← Symbolic links to sites-available.

PHP is working perfectly on 3 other sites, and one of those sites has an
almost identical config file (only thing changed are the names /
server_names, etc).

-------- Original-Nachricht --------

Datum: Mon, 28 May 2012 17:53:48 +0100
Von: Adrian H. [email protected]
An: [email protected]
Betreff: Re: php-fpm works with some sites but not others?

All permissions look correct to me. I very much doubt it is something

I don’t even know how you set up your config… (one instance per
host? One file per host? One “set” file per host? One big file?)

/etc/nginx/sites-available/ ← Individual config file per host.
/etc/nginx/sites-enabled/ ← Symbolic links to sites-available.

PHP is working perfectly on 3 other sites, and one of those sites has an
almost identical config file (only thing changed are the names /
server_names, etc).

If you are so super confident that everything is okay with the files
then I would suggest you to do this.

Assume you have host1, host2, host3 and host4. The one not working is
host4 while host1 to host3 work.

Now go on and edit the configuration for host4 and just change the
document root to point to one of the other hosts (aka host1 or host2 or
host3). I know, I know. This will break host4 but host4 is anyway not
working (according to your statement). So after reloading nginx go into
a browser and check if host4 is now working (showing the content of the
other selected host). If this is the case then it is not the nginx
configuration.


Adrian H.


Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de

On Mon, May 28, 2012 at 05:07:46PM +0100, Adrian H. wrote:

Hi there,

Everything was working perfectly, until for some reason one site just
failed to show anything.

I made sure the permissions were correct, and the nginx config file hasn’t
changed. One bizarre thing is that a call to phpinfo() returns “File not
found”, but I can’t seem to find a fix for this online.

A frequent response from nginx for a “broken” php setup is “HTTP/1.1
404 Not Found”, with a header indicating “X-Powered-By: PHP”, and a body
content of “No input file specified.”

A frequent reason for this is that the SCRIPT_FILENAME fastcgi param
sent by nginx to the fastcgi server does not identify a file that the
fastcgi server is able to access.

(Different fastcgi servers may use different param names to identify
the file.)

If you examine your nginx config for the server and location which
handles
a working request, you may be able to determine what SCRIPT_FILENAME is
set to. Do the same for the server and location of a failing request,
and you may see the relevant difference.

Alternatively, if you enable the debug log, you’ll see something like

fastcgi param: “SCRIPT_FILENAME: /usr/local/nginx/html/php”

which will show you exactly what it is set to for your requests (as well
as all of the other params that are set).

Maybe that will help you spot the difference between a working request
and a failing one.

Good luck with it,

f

Francis D. [email protected]