This is actually a two part question. I've got a LAMP configuration and a web site that relies heavily on the error_log functionality built into PHP. The error log is growing rather large in size.

My first question is can I configure PHP (php.ini) to output these error messages to the Apache error log file?

If I can't, my second question is how can I rotate the PHP error log once a day? Is it possible to pipe the PHP error log to Cronolog (like you can in apache) or another log rotator? I'd like to stick with Cronolog if at all possible.

Thanks in advance.


I dont know what is your OS but at php.ini look for the line error_log

Since you sent the error to apache you can now rotate the logs within it, if your apache is already being rotated by the syslog there is not need for this, but if it is not:

ErrorLog "|bin/rotatelogs /var/logs/errorlog.%Y-%m-%d-%H_%M_%S 5M"

  • That was my first question. Can I sent configure PHP (in php.ini) to send error messages to the Apache error log? And if so, how? – Jay Aug 14 '10 at 13:44
  • BTW, to answer your question, I'm using CentOS 5.5. Thanks for your help. – Jay Aug 14 '10 at 13:48
  • @Jay the first phrase has a link on the bolded error_log which will lead you to a page showing where the variable is in the php.ini. So you can simple change it to what it the path is in your system. – Prix Aug 15 '10 at 2:14

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.