php-5.3.4 の設定について
先日、Gentoo Linux の php のバージョンが 5.3.3-r1 から 5.3.4 にアップした。
結果、個人サーバーで運用している concrete5 にアクセスすると、数百行に及ぶメッセージが出力されるようになった。以下はその一部。
Strict Standards: Non-static method Loader::database() should not be called statically in /var/www/localhost/htdocs/fusion/concrete/dispatcher.php on line 23 Strict Standards: Non-static method Loader::library() should not be called statically in /var/www/localhost/htdocs/fusion/concrete/libraries/loader.php on line 139 Strict Standards: Non-static method Loader::library() should not be called statically in /var/www/localhost/htdocs/fusion/concrete/libraries/loader.php on line 140 Strict Standards: Non-static method Loader::library() should not be called statically in /var/www/localhost/htdocs/fusion/concrete/libraries/loader.php on line 141
/etc/php/apache2-php5.3/php.ini の "Error handling and logging" の部分(460行目以降)を見ると、
; Common Values: ; E_ALL & ~E_NOTICE (Show all errors, except for notices and coding standards warnings.) ; E_ALL & ~E_NOTICE | E_STRICT (Show all errors, except for notices) ; E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR (Show only errors) ; E_ALL | E_STRICT (Show all errors, warnings and notices including coding standards.) ; Default Value: E_ALL & ~E_NOTICE ; Development Value: E_ALL | E_STRICT ; Production Value: E_ALL & ~E_DEPRECATED ; http://php.net/error-reporting error_reporting = E_ALL | E_STRICT
となっていて、error_reporting = E_ALL | E_STRICT からして、今回の php は「開発用」としてインストールされたらしい。
なので、concrete5 のようなウェブアプリケーションを正常動作させるには、これを、
error_reporting = E_ALL & ~E_NOTICE (註:デフォルト)
または
error_reporting = E_ALL & ~E_DEPRECATED (註:プロダクション)
と変更する必要がある。
なお、この設定変更を反映させるには、以下のように apache の再起動を行なうこと。
/etc/init.d/apache2 restart