ホーム > カテゴリ > サーバー構築・運用・Linux >

PHP message: PHP Noticeを非表示にする [PHP.ini]

Nginxのerror.logに出力されるPHPのメッセージ「FastCGI sent in stderr: PHP message: PHP Notice:xxx」をログに出力させない方法です。

エラーログ(error.log)の例

2019/10/04 21:41:01 [error] 13692#13692: *213 FastCGI sent in stderr: "PHP message: PHP Notice:  Undefined index: id in xxx.php on line 43
2019/10/04 21:41:07 [error] 13692#13692: *213 FastCGI sent in stderr: "PHP message: PHP Notice:  Undefined index: action in xxx.php on line 66

PHP.iniの編集

PHP.iniを次のように変更すればOkです。

// (変更前)デフォルト
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT

// (変更後)E_NOTICEを非表示にする
error_reporting = E_ALL & ~E_NOTICE

PHP.iniの場所

// 次のコマンドを実行する
php --ini

※Loaded Configuration FileがPHP.iniです。





関連記事



公開日:2019年10月08日
記事NO:02785