Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a web-server running multiple server (virtual hosts) using nginx and fastcgi passing to a unix-socket.

What I want to accomplish is a set-up with and, where the live site has error_reporting turned off (but still logs to file), and on the beta-site error_reporting is on.

So with Apache I would do something in the lines of:

<VirtualHost *:80>


    php_flag display_errors on
    php_flag display_startup_errors on
    php_value error_reporting -1


When googling I haven't found anything where I can pass this kind of parameters to PHP using fastcgi. Does anyone know how to do this?

The configuration right now is (simplified):

server {
    fastcgi_pass unix:/var/run/nginx/php-fastcgi.sock;
    fastcgi_index index.php;
share|improve this question
Have you tried pho.ini a google search brings up quite a few results, have have you found so far? – Drew Khoury Nov 27 '13 at 13:15

You can pass these options to PHP fastcgi from nginx with this syntax:

fastcgi_param PHP_FLAG "display_errors=on \n display_startup_errors=on";
fastcgi_param PHP_VALUE "error_reporting=-1";

Note the newline (\n) character that has to be between the passed options.

share|improve this answer
I think, also, that the spaces should not be there. – Michael Hampton Nov 27 '13 at 17:10
this does absolutely nothing for me. I had to add to php.ini directly for my setting. Is there a reason why the fastcgi_param PHP_FLAG will not work with Nginx? Do I need to turn something else on in PHP or Nginx? I put the setting in my location { } block – Michael Butler Jul 3 '15 at 23:01

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.