WindowsのXAMPPでPHPのログを出力する

PHPでは、標準の関数として error_log関数が用意されています。
WindowsのXAMPPでPHPのログを出力するには、
C:\xampp\php\php.ini の、

; Log errors to specified file.
;error_log = “C:\xampp\apache\logs\phperror.log”

をコメントをはずして、

; Log errors to specified file.
error_log = “C:\xampp\apache\logs\phperror.log”

にします。
必要に応じて、

; – Show all errors except for notices and coding standards warnings
error_reporting = E_ALL & ~E_NOTICE

; – Show all errors, except for notices
error_reporting = E_ALL & ~E_NOTICE | E_STRICT

にするとよいでしょう。

参考:
ウノウラボ Unoh Labs – PHPによるテキストファイルへのロギング

You can leave a response, or trackback from your own site.

Leave a Reply