开发者

PHP error_log() not writing to disk in cron job

When running PHP scripts as cron jobs, the error handler works but the error_log() function doesn't writ开发者_Python百科e to disk. I included these lines in the script run through cron in case it was because the php.ini values weren't getting picked up, but still no output to the error log.

ini_set('display_startup_errors', 0);
ini_set('display_errors', 0);
ini_set('error_log', LOG_FOLDER . 'error_log.txt'); 

Error handling in general is working as expected, and the error messages appear in the cron output email that I get.

As a workaround I could detect that the script is running as a cron job by checking $_SERVER, and then writing to the error log using fopen(), etc. But I was hoping I could get it set up right and just use error_log().


Well I just realized that is was just my mistake and the LOG_FOLDER was actually not correct, there was a folder missing. :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜