I'm trying to writes PHP error to a mysql database. If there’s a way we can change it so that instead of writing directly to an error_log file, it sends the error to a script, which records it in the db.

  • What about rsyslog or syslog-ng ? Send your mysql logs to a syslog server, then setup a filter on it that will intercept php errors and throttle your own script to update your db with the error message. This is the way i would do it.
    – krisFR
    Jul 20, 2016 at 0:11

1 Answer 1


How about using a framework for logging. Log4PHP would also improve your logging over all. It has a MySQL appender. https://logging.apache.org/log4php/docs/appenders/pdo.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.