-1

I'm trying to turn on html_errors in PHP CLI. I've already found the proper config via php -i and uncommented the line html_errors = On there.

This is how I find the config file:

$ php -i | grep 'Loaded Configuration File'
Loaded Configuration File => /etc/php/8.1/cli/php.ini

This is how I check the (now uncommented) directive:

$ grep 'html_errors' /etc/php/8.1/cli/php.ini
html_errors = On

But I still see it turned off:

$ php -i | grep 'html_errors'
html_errors => Off => Off

What am I missing? According to this answer, the configuration is loaded fresh each time you invoke PHP from the CLI. I also restarted my php-fpm service, but that didn't help and it shouldn't be at all related to CLI configuration.

Paolo42
  • 182
  • 1
  • 8
  • are you using php-fpm with nginx or you have installed apache with default php events.... either way for settings to take effect properly you should restart php process... – Anant V May 01 '23 at 10:47
  • @AnantV I'm using php-fpm with nginx. I restarted the fpm service to be sure but that shouldn't matter in CLI. It didn't help. – Paolo42 May 01 '23 at 10:57

1 Answers1

1

Per the docs about "Remarkable differences of the CLI SAPI compared to other SAPIs", html_errors is set to false when using the CLI, and the documentation continues to say:

These directives cannot be initialized with another value from the configuration file php.ini or a custom one (if specified). This limitation is because the values are applied after all configuration files have been parsed. However, their values can be changed during runtime...

Chris Haas
  • 53,986
  • 12
  • 141
  • 274