Hi there,
I have two main problems about nginx(0.6.32)+fastcgi-php (4.4.9). I am
spawning php with spawn-fcgi thing and chrooting. nginx and fastcgi
processes are on different machines.
- PHP is not logging error nor display them even it defined in php.ini
file which I am using while spawning php. php.ini directives below;
error_reporting = E_ALL & ~E_NOTICE
display_errors = On
log_errors = On
error_log = /php.errors
fastcgi.log = 1
But still I see a blank page and there is no php.errors file. "/ " path
is also owned by php-user so there are no permission problems about
that.
- When an unexisted page requested from fastcgi-php, it says “no input
file specified”. In nginx logs it shows 404 code but it doesnt shows 404
page, instead gives that message. How can I get rid of this message?
Some apache users found something with url-rewrite but I dont want to
use url-rewrite thing.
Thanks.
I have looked at your first question again and scratch that
fastcgi_index
in previous post…
Things to check (or common mistakes):
- Are the php files localy on the fastcgi backend?
- Is the spawn script (spawn-php.sh) set to enable remote connections
(by
default its usually only localhost)
- Does the php load the right php.ini (is in path) - you can check by
running the php executable on the shell ‘php-cgi’ or ‘php’ at <?
phpinfo();
?> output (look at Configuration File (php.ini) Path - it should show
full
path to the .ini file used or none if php can’t find one).
Or by creating some dummy file like <? notexistantfunction(); ?> and
running
‘php dymmy.php’ and looking if the errorfile is created on the fastcgi
machine.
rr
I have asked the same questions a bit ago and here is the thread:
http://www.ruby-forum.com/topic/163301
As to quick answers:
- Probably fastcgi_index index.php; is missing from the config.
- See the url above.
Iin short location ~ .php$ catches and overrides before the global
error_page 404 (eg it sends the request to php backend even the file
doesnt
exist))
Quick workarround:
location ~ .*.php$ {
if (!-f $request_filename) {
return 404;
}
fastcgi_pass …
…
}
rr
----- Original Message -----
From: “Anýl Çetin” [email protected]
To: [email protected]
Sent: Saturday, September 06, 2008 1:51 PM
Subject: fastcgi debug and “no input file” cases
Thanks Reinis and sorry that I did not read the fastcgi module
reference. The “fastcgi_intercept_errors” thing seems to solve problem
“2”. Do you have an idea about problem “1”?
Php files are working as expected and it loads right php.ini file. My
problem is there is no error log displayed nor error written to file.
Reinis R.
yazmýþ:> I have asked the same questions a bit ago and here is the thread:
The problem “3” is making default index “index.php”. I did it by using
rewrite;
location = / {
rewrite ^ /index.php;
}
must I use rewrite? When I do it like;
location / {
index index.php;
}
nginx does not pass “index.php” to fastcgi, rather than it looks in its
own root and of course says 404.
thanks.
Anýl Çetin
yazmýþ:> Hi there,
Here’s a few snippets from my config that are definitely working:
http {
…
index index.php;
…
server {
…
root /var/www/whatever/you/use
location ~ .php$ { fastcgi_pass 127.0.0.1:9000; include fastcgi_params;
}
…
}
}
Make sure that your fastgi_params file contains this:
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
without that line you will get the “no input specified” msg because an
incorrect or missing script name gets passed on to php.
Chris