Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

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"

share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.