PHP Output to Syslog on Ubuntu
Posted by Paul on 26th November 2009
There are just a few things you need to know in order to output trace or error information to syslog on an Ubuntu system from PHP (the following is probably true for other Debian-based distributions, too).
- Set error logging to
syslog
inphp.ini
(the system-widephp.ini
can be found at/etc/php5/php.ini
):
error_log = syslog
- Restart Apache:
$ sudo /etc/init.d/apache2 restart
Use the error_log()
function to output your error messages.
- View the output of error messages:
$ tail -f /var/log/syslog
The -f
flag causes new messages to be appended to the output of tail
.