[PEAR] How to Configure Settings to Hide Strict, Deprecated Errors and Warnings

Tadashi Shigeoka ·  Wed, November 16, 2011

When I started using PHP’s PEAR, a large number of errors immediately appeared.

Since it seems like the error output settings can be changed

Deprecated: Assigning the return value of new by reference is deprecated in ~ 

and

Strict Standards

errors are displayed.

PHP: error_reporting - Manual

The default setting is as follows:

error_reporting = E_ALL | E_STRICT

You can configure it like this to prevent E_STRICT and E_DEPRECATED errors from appearing:

error_reporting = E_ALL & ~E_DEPRECATED

After configuration, restart Apache to apply the settings.

# /usr/local/apache2/bin/httpd -k graceful

To confirm if the error_reporting setting is applied, use the # php -i | less command:

Configuration File (php.ini) Path => /usr/local/lib
Loaded Configuration File => (none)

Since Loaded Configuration File shows none, it seems php.ini is not being loaded.

For some reason, I had placed it in /usr/local/lib/php/php.ini, so it wasn’t being loaded.

When I properly moved php.ini directly under the /usr/local/lib/ directory, the settings seem to be applied:

Configuration File (php.ini) Path => /usr/local/lib
Loaded Configuration File => /usr/local/lib/php.ini
# php -i | grep error_reporting
error_reporting => 22527 => 22527

That’s all from the Gemba.

【References】 ・php5.3でDeprecatedエラーに遭遇 « kawama.jp

神経研メディアセンター: PHP5の安全設定

PHP5でPEAR::DBを教本通り使ったらStrict Standardsエラーが発生した件 - TMD45LOG!!!

PEARの呼び出しなどで出るStrict errorやWarningを一時的に消す方法 - Layer8 Reference

php5.3 Assigning the return value of new by reference is deprecated - 為せば成る・・・かもしれない