4

Ubuntu 16.04, Lighty 1.4.35, PHP 7.0.4-7ubuntu2 (in a Hyper-V VM)

I browsed all (or at least many) of the other questions about php.ini.


No matter what value I set for any of the directives; ini_get returns does not necessarily return that value. And php´s behaviour doesn´t seem to have anything to do with either of them.

  • no error messages in browsers, although display_errors is On by default. (php_info shows "Off" in the browser and on CLI)
  • full error messages (including notices) are listed on CLI and written to the server log, although the default value for error_reporting excludes E_NOTICE. (And php_info displays the default value, no matter what I put in any php.ini file)
  • all messages are written to the lighttpd/error.log, although log_errors is Off by default. And no matter what I set it to): php_info() says it´s on.

php -h tells, that php -c <path>|<file> can be used to change the ini file path. calling info.php with PHP CLI

  • with no other parameters: Config File Path: CLI, Loaded Config File: CLI
  • with -c /etc/php/7.0/fpm/ini.php: File Path: CLI, Loaded: (none)
  • with -c /etc/php/7.0/fpm/: File Path: (still !!) CLI, Loaded: FPM

It all works well on my old machine (Ubuntu 14.04.4, Lighty 1.4.33, PHP 7.0.7-4+deb.sury.org~trusty+1); but I cannot find anything in the PHP 7 ChangeLog that would explain my problems.

Any ideas while I inspect the other included ini files one by one?

3
  • phpinfo() tells you what INI files are being parsed. Maybe you have the wrong ones.
    – ceejayoz
    Jun 14, 2016 at 14:32
  • There are only three php,ini files on the machine; and I edited them all. The mistake isn´t beatable on stupidity.
    – Titus
    Jun 14, 2016 at 18:23
  • I'm not sure what "the mistake isn't beatable on stupidity" means, but I'd encourage you to peruse phpinfo()'s output anyways. It should show what folder it expects .ini files in. The three you edited may still not be the ones it's looking in.
    – ceejayoz
    Jun 14, 2016 at 18:26

3 Answers 3

1

A simple grep -n error_reporting on the ini file revealed everything:

error_reporting default, development and production settings are described in php.ini around line 105.

I added my setting on line 111.

And there had already been a setting more than 300 lines below that, which overrode my setting.

TILT

0

If php-fpm runs as a daemon, restart it to reload php.ini

3
  • yes this problem drove me nuts for a fair bit on a new CentOS 8 installation. service php-fpm restart will make it read the edited php.ini file
    – Anthony
    Jan 18, 2021 at 6:42
  • @Anthony I'm on Amazon Linux which is like CentOS and restarting php-fpm isn't doing it for me either. Jan 19, 2021 at 1:47
  • 1
    I found the problem in /etc/php-fpm.d/www.conf. This line: php_flag[display_errors] = on. Commented that line, restarted php-fpm (no need to restart apache, apparently), and finally my errors are not being shown to the world. Jan 19, 2021 at 2:28
0

This might be silly, but I was on AWS and I had to restart the instance to get php.ini reloaded.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .