简体   繁体   English

数据库中的PHP-FPM日志错误

[英]PHP-FPM log errors in database

I'd like to log all errors encountered on the server to MySQL rather than error_log file. 我想将服务器上遇到的所有错误记录到MySQL而不是error_log文件中。 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. 具体来说,我正在寻找一个可能在服务器范围内集成的选项(这并不意味着要使用php.ini设置在每个PHP文件前添加一个文件),最有可能是C ++模块。

  • Are there any known option? 有什么已知的选择吗?
  • Is it possible to create one? 是否可以创建一个?

If you're running Linux, here is a solution for you: 如果您使用的是Linux,则可以使用以下解决方案:

  1. Make PHP write logs to syslog ( error_log = syslog in php.ini) 使PHP将日志写入syslog(php.ini中的error_log = syslog
  2. Install rsyslog if not already installed (it's default on Debian I think, I don't know about the other distribs) 安装rsyslog如果尚未安装(它的Debian的默认,我认为,我不知道其他发行商)
  3. Configure rsyslog to write the logs to MySQL (see http://www.rsyslog.com/doc/rsyslog_mysql.html ) 配置rsyslog以将日志写入MySQL(请参阅http://www.rsyslog.com/doc/rsyslog_mysql.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM