Php-errors.log - Is There Anyway I Can Restrict The File Size?

Good Afternoon All

Our php-errors.log file is creating an extremely large file on a new windows 2008 server running IIS7.

We are going to go through and correct all of the errors, but in the meantime, is there a way that I can restrict the file size?

I’ve looked at but this didn’t seem to offer an answer.

Thank you in advance for any help


Look at log_errors_max_len

Thankyou for replying so quickly cpradio

Something seems to be not quite right here.

My php.ini file configuration is the default

log_errors_max_len = 1024

But the log_errors file size is well over 1024 bytes?

Thats why I didn’t think that this was the solution. Would there be another configuration overiding this?

Well, it seems you and I both get to learn something new today. From StackOverflow, that setting only affects the max length for a single log entry, not the size of the error log. Why you would need 1 KB (the default) for a single log entry is beyond me.

Looks like you can use this log rotation tool in combination with 7-zip’s command line utility to control your logs (granted you will need to edit it to point to the PHP logs instead of apache.

Thank you very much again cpradio

I will look into this and let you know the result

Thanks again, have a good evening

I’m just leaving the office, but can I just confirm this script will work with a windows server?

From what I understand the script I linked to was designed for a windows server

Play about with these file name settings:

  define('APPPATH', 'where_ever_is_best');

  ini_set('error_log', APPPATH .'php_error_' .date('Y-m-d-h-m') .'.log');

  echo ini_get('error_log');
  # where_ever_is_best//php_error_2012-05-11-06-05.log


Hello John-Betong

I’ll play around with both of these ideas, thanks for all of your help, I appreciate you both taking the time and responding so quickly.