PHP CLI won't log errors

Viewed 94923

PHP currently will not log errors produced from the command line.

I have:

log_errors = On
error_log = /var/log/php_errors.log

in file /etc/php5/cli/php.ini.

Am I missing a further setting to get this working?

6 Answers

As a diagnostic, you can attempt to force a write to the error log this way:

php -c /etc/php5/cli/php.ini -r " error_log('test 123'); "

You should now see test 123 in your log:

tail /var/log/php_errors.log
Related