0

I'd like to log all errors encountered on the server to MySQL rather than error_log file. There is a similar question already. However, the answer suggests to integrate a custom error handler.

To be specific, I am looking for an option that could be integrated server wide (that doesn't mean prepending a file to every PHP file using php.ini settings), most likely C++ module.

  • Are there any known option?
  • Is it possible to create one?
Community
  • 1
  • 1
Gajus
  • 69,002
  • 70
  • 275
  • 438

1 Answers1

2

If you're running Linux, here is a solution for you:

  1. Make PHP write logs to syslog (error_log = syslog in php.ini)
  2. Install rsyslog if not already installed (it's default on Debian I think, I don't know about the other distribs)
  3. Configure rsyslog to write the logs to MySQL (see http://www.rsyslog.com/doc/rsyslog_mysql.html)
rlanvin
  • 6,057
  • 2
  • 18
  • 24