# PHP + FPM with error pages

**URL:** <https://www.ruby-forum.com/t/php-fpm-with-error-pages/205506>\
**Category:** NGINX\
**Created:** [April 7, 2011, 7:38pm UTC](https://www.ruby-forum.com/t/php-fpm-with-error-pages/205506 "2011-04-07T19:38:40Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [April 7, 2011, 7:38pm UTC](https://www.ruby-forum.com/t/php-fpm-with-error-pages/205506/1 "2011-04-07T19:38:40Z")

</div>

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](http://pastebin.com/raw.php?i=fz5xRkTH)  
(-) my vhost - [http://pastebin.com/raw.php?i=uxTUiPM0](http://pastebin.com/raw.php?i=uxTUiPM0)

Thanks in advance  
Humza

Posted at Nginx Forum:

> **[PHP + FPM with error pages](https://forum.nginx.org/read.php?2,189193,189193#msg-189193)**
>
> 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...

---

<div class="post-metadata">

**Author:** ![Humza](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/f19dbf/32.png) [@Humza](https://www.ruby-forum.com/u/Humza)\
**Post date:** [April 7, 2011, 7:42pm UTC](https://www.ruby-forum.com/t/php-fpm-with-error-pages/205506/2 "2011-04-07T19:42:59Z")

</div>

I might as well add my php-fpm.conf -  
[http://pastebin.com/raw.php?i=vWZJcqQh](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](http://pastebin.com/raw.php?i=p5yRQV6D)

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

Posted at Nginx Forum:

> **[Re: PHP + FPM with error pages](https://forum.nginx.org/read.php?2,189193,189195#msg-189195)**
>
> 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...

---

<div class="post-metadata">

**Author:** ![Humza](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/f19dbf/32.png) [@Humza](https://www.ruby-forum.com/u/Humza)\
**Post date:** [April 7, 2011, 8:26pm UTC](https://www.ruby-forum.com/t/php-fpm-with-error-pages/205506/3 "2011-04-07T20:26:15Z")

</div>

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](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](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?

> **[GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki...](https://github.com/nginxinc/nginx-wiki)**
>
> ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com

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

Good luck,

## f

Francis D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![Humza](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/f19dbf/32.png) [@Humza](https://www.ruby-forum.com/u/Humza)\
**Post date:** [April 7, 2011, 8:43pm UTC](https://www.ruby-forum.com/t/php-fpm-with-error-pages/205506/4 "2011-04-07T20:43:35Z")

</div>

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:

> **[Re: PHP + FPM with error pages](https://forum.nginx.org/read.php?2,189193,189217#msg-189217)**
>
> 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...

---

<div class="post-metadata">

**Author:** ![Humza](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/f19dbf/32.png) [@Humza](https://www.ruby-forum.com/u/Humza)\
**Post date:** [April 7, 2011, 8:51pm UTC](https://www.ruby-forum.com/t/php-fpm-with-error-pages/205506/5 "2011-04-07T20:51:37Z")

</div>

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. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![Humza](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/f19dbf/32.png) [@Humza](https://www.ruby-forum.com/u/Humza)\
**Post date:** [April 7, 2011, 8:31pm UTC](https://www.ruby-forum.com/t/php-fpm-with-error-pages/205506/6 "2011-04-07T20:31:49Z")

</div>

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

[http://aero](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](http://forum.nginx.org/read.php?2,189193,189213#msg-189213)

---

<div class="post-metadata">

**Author:** ![Humza](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/f19dbf/32.png) [@Humza](https://www.ruby-forum.com/u/Humza)\
**Post date:** [April 7, 2011, 8:57pm UTC](https://www.ruby-forum.com/t/php-fpm-with-error-pages/205506/7 "2011-04-07T20:57:47Z")

</div>

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](http://forum.nginx.org/read.php?2,189193,189222#msg-189222)

---

<div class="post-metadata">

**Author:** ![Humza](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/f19dbf/32.png) [@Humza](https://www.ruby-forum.com/u/Humza)\
**Post date:** [April 9, 2011, 9:48pm UTC](https://www.ruby-forum.com/t/php-fpm-with-error-pages/205506/8 "2011-04-09T21:48:08Z")

</div>

bump!

Posted at Nginx Forum:

> **[Re: PHP + FPM with error pages](https://forum.nginx.org/read.php?2,189193,189749#msg-189749)**
>
> 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...

---

<div class="post-metadata">

**Author:** ![Humza](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/f19dbf/32.png) [@Humza](https://www.ruby-forum.com/u/Humza)\
**Post date:** [April 11, 2011, 6:49pm UTC](https://www.ruby-forum.com/t/php-fpm-with-error-pages/205506/9 "2011-04-11T18:49:20Z")

</div>

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:

> **[Re: PHP + FPM with error pages](https://forum.nginx.org/read.php?2,189193,190219#msg-190219)**
>
> 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...
