[PHP]

error_reporting()設定値チェッカ


error_reportingの値を入力すると、その値の意味が下に表示されます。(例:10を入力すると、2:E_WARNINGと8:E_NOTICEが表示されます)



E_ALLの値チェック
E_ALL=32767


名称 内容(日本語) 内容(英語)
E_ERROR 1 重大な実行時エラー。これは、メモリ確保に関する問題のように復帰で きないエラーを示します。スクリプトの実行は中断されます。 Fatal run-time errors. These indicate errors that can not be recovered from, such as a memory allocation problem. Execution of the script is halted.
E_WARNING 2 実行時の警告 (致命的なエラーではない)。スクリプトの実行は中断されません。 Run-time warnings (non-fatal errors). Execution of the script is not halted.
E_PARSE 4 コンパイル時のパースエラー。パースエラーはパーサでのみ生成されます。 Compile-time parse errors. Parse errors should only be generated by the parser.
E_NOTICE 8 実行時の警告。エラーを発しうる状況に遭遇したことを示す。 ただし通常のスクリプト実行の場合にもこの警告を発することがありうる。 Run-time notices. Indicate that the script encountered something that could indicate an error, but could also happen in the normal course of running a script.
E_CORE_ERROR 16 PHPの初期始動時点での致命的なエラー。E_ERRORに 似ているがPHPのコアによって発行される点が違う。 Fatal errors that occur during PHP's initial startup. This is like an E_ERROR, except it is generated by the core of PHP.
E_CORE_WARNING 32 (致命的ではない)警告。PHPの初期始動時に発生する。 E_WARNINGに似ているがPHPのコアによって発行される 点が違う。 Warnings (non-fatal errors) that occur during PHP's initial startup. This is like an E_WARNING, except it is generated by the core of PHP.
E_COMPILE_ERROR 64 コンパイル時の致命的なエラー。E_ERRORに 似ているがZendスクリプティングエンジンによって発行される点が違う。 Fatal compile-time errors. This is like an E_ERROR, except it is generated by the Zend Scripting Engine.
E_COMPILE_WARNING 128 コンパイル時の警告(致命的ではない)。E_WARNINGに 似ているがZendスクリプティングエンジンによって発行される点が違う。 Compile-time warnings (non-fatal errors). This is like an E_WARNING, except it is generated by the Zend Scripting Engine.
E_USER_ERROR 256 ユーザーによって発行されるエラーメッセージ。E_ERROR に似ているがPHPコード上でtrigger_error()関数を 使用した場合に発行される点が違う。 User-generated error message. This is like an E_ERROR, except it is generated in PHP code by using the PHP function trigger_error().
E_USER_WARNING 512 ユーザーによって発行される警告メッセージ。E_WARNING に似ているがPHPコード上でtrigger_error()関数を 使用した場合に発行される点が違う。 User-generated warning message. This is like an E_WARNING, except it is generated in PHP code by using the PHP function trigger_error().
E_USER_NOTICE 1024 ユーザーによって発行される注意メッセージ。E_NOTICEに に似ているがPHPコード上でtrigger_error()関数を 使用した場合に発行される点が違う。 User-generated notice message. This is like an E_NOTICE, except it is generated in PHP code by using the PHP function trigger_error().
E_STRICT 2048 コードの相互運用性や互換性を維持するために PHP がコードの変更を提案する。 Enable to have PHP suggest changes to your code which will ensure the best interoperability and forward compatibility of your code.
E_RECOVERABLE_ERROR 4096 キャッチできる致命的なエラー。危険なエラーが発生したが、 エンジンが不安定な状態になるほどではないことを表す。 ユーザー定義のハンドラでエラーがキャッチされなかった場合 (set_error_handler() も参照ください) は、 E_ERROR として異常終了する。 Catchable fatal error. It indicates that a probably dangerous error occurred, but did not leave the Engine in an unstable state. If the error is not caught by a user defined handle (see alsoset_error_handler()), the application aborts as it was an E_ERROR.
E_DEPRECATED 8192 実行時の注意。これを有効にすると、 将来のバージョンで動作しなくなるコードについての警告を受け取ることができる。 Run-time notices. Enable this to receive warnings about code that will not work in future versions.
E_USER_DEPRECATED 16384 ユーザー定義の警告メッセージ。これはE_DEPRECATED と同等だが、 PHP のコード上で関数 trigger_error() によって作成されるという点が異なる。 User-generated warning message. This is like an E_DEPRECATED, except it is generated in PHP code by using the PHP function trigger_error().

補足

設定値のチェック方法

コマンドラインからチェックする場合
php -r "error_reporting() . PHP_EOL"

error_reportingの設定方法


*.phpで設定する場合

数値指定:
// 数値で指定
error_reporting(22418);             

// 定数で指定
error_reporting(0);                            // 何もしない
error_reporting(E_ALL);                        // 全て出力
error_reporting(E_ALL & ~E_NOTICE);            // E_NOTICE以外の全てを出力
error_reporting(E_ALL & ~(E_STRICT|E_NOTICE)); // E_STRICTとE_NOTICE以外の全てを出力

定数指定:
error_reporting(E_ALL & ~E_NOTICE);

php.iniで設定する場合

error_reporting=E_ALL

.htaccessで設定する場合

(htaccessでは数値で指定する必要があります)
php_value error_reporting 22418