PHP Output to Syslog on Ubuntu

There are just a few things you need to know in order to output trace or error information to syslog on an Ubuntu system (the following is probably true for other Debian-based distributions, too) from PHP.

  1. Set error logging to syslog in php.ini (the system-wide php.ini can be found at /etc/php5/php.ini):
    error_log = syslog
  2. Restart Apache:
    $ sudo /etc/init.d/apache2 restart
  3. Use the error_log() function to output your error messages.
  4. 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.

Labels: , , ,

Bookmark and Share

0 Comments:

Post a Comment

Subscribe to this blog
rss news feed icon