raphael
raphael

Reputation: 352

Settings in php.ini partially ignored?

Somehow my php.ini is partially ignored. For instance, I can change the setting for displaying errors, but not for error reporting.

The setup is the following:

$ php -i | grep "Configuration file"
Configuration File (php.ini) Path => /usr/local/php5/lib
Loaded Configuration File => /usr/local/php5/lib/php.ini

Let’s check the the values of error_reporting and display_errors:

grep "error_reporting\|display_errors"
error_reporting => 32767 => 32767
display_errors => Off => Off

Let’s change the values (error_reporting = E_ERROR, display_errors = on), restart Apache and check again:

$ sudo nano /usr/local/php5/lib/php.ini
$ sudo apachectl restart
$ php -i | grep "error_reporting\|display_errors"
error_reporting => 32767 => 32767
display_errors => STDOUT => STDOUT

It doesn’t matter where I check these settings. They’re the same on both Browser and Terminal. error_reporting is ALWAYS 32767 (=E_ALL).

Even the setting disable_functions did not help at all.

disable_functions = error_reporting

Same goes for timezone, the setting is simply ignored. But post_max_size and upload_max_filesize are alterable.

What’s wrong with my configuration?

Upvotes: 0

Views: 917

Answers (2)

zzapper
zzapper

Reputation: 5043

Hi do you have set_error_handler in your code?

set_error_handler("my_error_handler"); // override error_reporting()

Upvotes: 0

raphael
raphael

Reputation: 352

By installing PHP 5.5 via

curl -s http://php-osx.liip.ch/install.sh | bash -s 5.5

a file named 99-liip-developer.ini will be installed in /usr/local/php5/php.d. This overwrites some settings (see http://php-osx.liip.ch/#faq).

After renaming or deleting the file, PHP works as expected.

I found this out by

$ php -i | grep "Scan this dir for additional"
Scan this dir for additional .ini files => /usr/local/php5/php.d
grep -R "error_reporting" /usr/local/php5/php.d/

Credits to suchit!

Upvotes: 1

Related Questions