[ACCEPTED]-how to get php errors to show on syslog-syslog

Accepted answer
Score: 10

I have this in my /etc/php5/cli/php.ini file (I use Debian; I'm 3 assuming its the same for whatever you are 2 using) and it writes out all cron errors 1 to /var/log/messages:

error_reporting  =  E_ALL & ~E_NOTICE
display_errors = Off
display_startup_errors = Off
log_errors = On
log_errors_max_len = 0
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
track_errors = Off
error_log = syslog
Score: 5

Try error_log = syslog in your php.ini.


Score: 5

There are two issues to consider:

First, PHP 7 CLI uses a different php.ini than the version 6 of PHP that runs via Apache. Make sure you 5 are editing the error_log in the CLI version.

Second, make 4 sure your log file is writable by the user 3 that runs cron. Usually the logfile is not 2 writable by your user account, so you may 1 need to edit permissions.

Score: 2

On Ubuntu 16.04, the /dev/log is owned by 4 group mysyslog (as defined by systemd). So 3 for apache2/php to be able to write into 2 syslog, you must add user www-data to group 1 mysyslog: addgroup www-data mysyslog

More Related questions