Strae
Strae

Reputation: 19465

PHP-FPM unable to override error_reporting?

I have a problem that's driving me crazy in the last couple of hours: I can't override the default value of error_reporting directive on my development machine (Debian 8 + php-fpm 5.6.29 + Nginx/1.6.2)

The php packages i'm using:

$ dpkg --get-selections | grep php
libapache2-mod-php5             install
php-console-table               install
php5                        install
php5-cli                    install
php5-common                 install
php5-curl                   install
php5-fpm                    install
php5-gd                     install
php5-intl                   install
php5-json                   install
php5-mcrypt                 install
php5-mysql                  install
php5-readline                   install
php5-xmlrpc                 install
php5-xsl                    install

Considering the following dead-simple script:

<?php
$initial_value = error_reporting(); // Just read the current value

error_reporting(E_PARSE); // Lets set it to something else.

$update_value = error_reporting(); // Read again.

printf(
  "Initial value: %s\nFinal value: %s",
  $initial_value,
  $update_value
);

if I run it from cli, it works:

$ php test.php
// output: Initial value: 22527 Final value: 4

But if I run this under php5-fpm, the output is:

Initial value: 32767 Final value: 32767

What I've tried:

Of course after every edits to ini files I did restart php5-fpm process (tried also stop and then start instead of restart/reload)

A strange thing is that I can actually override other parameters (display_errors for example, works both from ini files and from ini_set calls).

So, what am I missing so far?

Upvotes: 5

Views: 6775

Answers (1)

toster-cx
toster-cx

Reputation: 2387

This smells like php_admin_value. Check your fpm/php.ini or fpm/pool.d/* or fpm/conf.d/* for:

php_admin_value[error_reporting] = E_ALL

It's un-overwritable and produces the same output as you described. Can also be set from nginx configs, check for:

fastcgi_param PHP_ADMIN_VALUE ...

Upvotes: 3

Related Questions