Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get php errors to show on syslog

I have a script which is scheduled to run on crontab. I noticed that I could not see php errors anywhere. I wanted to be able to see php errors logged on /var/log/syslog or some place else. I have tried configuring my php.ini to log the errors on /var/log/php-errors.log, checked permissions and restarted the apache service still no logs.

like image 382
madkris24 Avatar asked Jun 24 '11 14:06

madkris24


People also ask

How do I get PHP errors to display?

Quickly Show All PHP Errors The quickest way to display all php errors and warnings is to add these lines to your PHP code file: ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL);

Where does PHP syslog write to?

If the syslog is used, then all PHP errors will be sent directly to the default system log file—in Linux, this is typically /var/log/syslog.

What is PHP syslog?

syslog() generates a log message that will be distributed by the system logger. For information on setting up a user defined log handler, see the syslog. conf (5) Unix manual page. More information on the syslog facilities and option can be found in the man pages for syslog (3) on Unix machines.


1 Answers

I have this in my /etc/php5/cli/php.ini file (I use Debian; I'm assuming its the same for whatever you are using) and it writes out all cron errors 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
like image 57
Femi Avatar answered Oct 01 '22 01:10

Femi