0

php-error.log keeps reporting the same error multiple times. Seems like with every browser request. Caching is disabled on most pages as this is a dynamic site with user-generated content.

In php.ini, both ignore_repeated_errors and ignore_repeated_source are On.

Does anybody have any ideas to fix this?

Thank you in advance

1 Answer 1

2

PHP log will not ignore repeated errors with ignore_repeated_errors = On - It will happen per script execution (so normally yes...per request). How are you running PHP (mod_php, fastcgi,...)? The best option would be to filter the log afterwards, but if you really want to get in there earlier you could use something like a cache that's passed through with the error message and only logged if there's a cache miss.

Or if you're running a typical LAMP stack you could use a db table for logging and only insert the new line if a recent one doesn't exist.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks Matt, php is run as an apache module.Your solution is too complicated for me :) Am thinking to just clear the errors with a cron job. Looking for the clear/empty equivalent for: find /home -name error_log
you could use the -exec flag on error_log to clear it out with something like "echo "" > {} \;" or whatever the syntax is. If you're feeling ambitious you could also use something like a combination of awk and uniq to merge adjacent repeated messages and then overwrite the file there.
I tried this but it did not work for me:find /home -name error_log -exec echo "" > {} \; // Any way to combine the cat /dev/null > /home with the find command ? // Basically I need to search the home dir for error_log files then clear them,Thanks a lot for your help

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.