'php-fpm (7.1.6) Doesn't turn on display_errors

System:
Debian Jessie
PHP-FPM 7.1.6
Apache 2.4.10
XDebug 2.5.4

PHP Won't display Parse and other fatal errors, while my php.ini clearly states display_errors = On. On the phpinfo() page, it says display_errors Off. It parses the correct Ini file and no additional ini files that could have overridden it.

error_reporting is set to E_ALL.

a grep display_errors of the ini file doesn't show any other setting than it turning on.

Am I missing something?



Solution 1:[1]

if display_errors shows On in your php.ini and phpinfo() shows off for the master value then there is definitely a problem somewhere in your configuration files (or a bug in PHP 7.1.6, but that is probably less likely).

It sounds like you've already checked all the details but it is worth double checking. In particular this is the list of items I would verify:

  1. Verify that the php.ini file referenced in your phpinfo() results (under Loaded Configuration File) matches the actual location of the php.ini file you are editing. Some systems might have more than one and I've been fooled by that before.
  2. Also make sure and grep the directory specified by Scan this dir for additional .ini files. If a file in there sets the display_errors directive (unlikely but possible) it will override anything in your php.ini file.
  3. Check for configuration directives in .htaccess files. These can also set the display_errors value. I'm pretty sure that when they do so they set the local value, not the master value, but I'm not 100%: it wouldn't hurt to check. (although this probably doesn't apply to PHP-FPM, so I guess I'm just mentioning this for completeness).
  4. I know it is silly, but just double check that your display_errors = On line isn't commented out.

I'm not aware of any other places that PHP configuration options might be set, but it could be that there are more obscure ones out there: a quick search for setting php.ini values via (system) environment variables didn't show up anything. That would be a good way to override settings without realizing it.

Solution 2:[2]

If your changes in /etc/php/7.1/fpm/php.ini are not reflected in your current PHP settings, e.g. phpinfo(), after restarting your HTTP server -like you were used to-, this may be because restarting the server does not restart the actual PHP subsystems, which are running in their own processes/sockets, hence the FPM thingy.

You want to restart PHP like this :

sudo systemctl restart php7.1-fpm

This is of course applicable to other PHP versions, just replace 7.1 by whatever version number X.Y .

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Conor Mancone
Solution 2 Gannur