PHP + FPM with error pages

I know that this question has been asked before but I can’t seem to fix
my error pages.

I am currently working on a website is on a vhost (not that I could get
a non-vhost php error message working). Any page or folder that doesn’t
have the .php extension displays my custom error page, but if it is a
.php file I just see a blank page.

My nginx.conf and the vhost that I am working on are here:
(-) nginx.conf - http://pastebin.com/raw.php?i=fz5xRkTH
(-) my vhost - http://pastebin.com/raw.php?i=uxTUiPM0

Thanks in advance
Humza

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,189193,189193#msg-189193

I might as well add my php-fpm.conf -
http://pastebin.com/raw.php?i=vWZJcqQh

I also have a file called www.conf inside the /etc/php-fpm.d folder -
http://pastebin.com/raw.php?i=p5yRQV6D

Also do I need a seperate php-fpm config file for every vhost?

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,189193,189195#msg-189195

On Thu, Apr 07, 2011 at 01:38:17PM -0400, Humza wrote:

Hi there,

I know that this question has been asked before but I can’t seem to fix
my error pages.

So… what have you tried?

I am currently working on a website is on a vhost (not that I could get
a non-vhost php error message working). Any page or folder that doesn’t
have the .php extension displays my custom error page, but if it is a
.php file I just see a blank page.

I don’t get a blank page for php script missing errors, but I can get
a page with just the words “No input file specified.”

My nginx.conf and the vhost that I am working on are here:
(-) nginx.conf - http://pastebin.com/raw.php?i=fz5xRkTH

That includes the line

include /etc/nginx/conf.d/*.conf;

so some of the configuration is hidden.

(-) my vhost - http://pastebin.com/raw.php?i=uxTUiPM0

That includes the line

include php;

so some more of the configuration is hidden.

What is fastcgi_intercept_errors set to?

http://wiki.nginx.org/HttpFcgiModule#fastcgi_intercept_errors

And if it is “on”, what does the debug log show?

Good luck,

f

Francis D. [email protected]

I found the “php” file it is below:

index index.php index.html index.htm;

location ~ .php$ {
include fastcgi_params;

fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9000;

}

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,189193,189217#msg-189217

On Thu, Apr 07, 2011 at 02:31:20PM -0400, Humza wrote:

Hi there,

so some of the configuration is hidden.

I’ve posted the bits that are relevant, except i dont know where to find
the bit where i included php.

You report problems only when trying .php urls.

The config you have shown says nothing about .php urls, other than
“include php”.

That would seem to make the file called php in the nginx compile-time
prefix directory (default /usr/local/nginx) relevant.

Look in that file (and in any include’d files) and see what
fastcgi_intercept_errors is set to in the location block that handles
.php urls.

If it is not set to “on”, understand what it does, and set it to “on”.

Test, and if it shows you what you want in this case, and doesn’t break
other cases, leave it on.

Otherwise, examine the debug log.

Good luck with it,

f

Francis D. [email protected]

Ok let me rephrase it then, I couldnt find a definitive fix. If you have
a link please post it.

http://aero’’’’’’’'crash.co.cc/aaa.php is an example phrase on the exact
vhost that im talking about

remove the ‘’’’’’’’

so some of the configuration is hidden.

I’ve posted the bits that are relevant, except i dont know where to find
the bit where i included php.

my fastcgi config is here:

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;

fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;

fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;

fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;

PHP only, required if PHP was built with --enable-force-cgi-redirect

fastcgi_param REDIRECT_STATUS 200;

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,189193,189213#msg-189213

I’m loosing you here, I posted the file called “php”, and that only has
one include which is to fastcgi_params which is below:

fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;

fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;

fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;

fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;

PHP only, required if PHP was built with --enable-force-cgi-redirect

fastcgi_param REDIRECT_STATUS 200;

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,189193,189222#msg-189222

bump!

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,189193,189749#msg-189749

Yay I fixed it:

location ~ .php$ {
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9000;
fastcgi_intercept_errors on;
error_page 404 /error/404.php;
}

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,189193,190219#msg-190219