How to limit the size of your error_log files

Every time a PHP error occurs on your site – whether it’s just a warning or an actual error – it is written to an error_log file in the folder where the failing file is located.

This means that some error_log files can grow very large if a page keeps generating warnings and errors every time it loads. In the end, this can result in having error_log files on your web hosting account that in some cases can take up several hundred MB.

However, you can disable this error_log if you don’t use it, or simply limit it to only writing fatal errors to the file.

You do this by editing your php.ini file.

You can find it by logging into cPanel, and then going to "PHP INI Editor".

Under this menu item, you need to select "Editor" mode and then choose the site you want to edit the ini file for.

In your ini file you can now add:

log_errors = Off

This completely disables writing errors to error_log files.

error_reporting = E_ERROR

Only writes fatal errors (not warnings) to error_log files.

  • 0 Users Found This Useful
Was this answer helpful?

Didn't find a solution?

If you haven't found a solution by searching or navigating our categories, you can open a new support ticket.

Open New Ticket

Related Articles

How to fix 503 errors on your website

A 503 error occurs when there aren't enough resources to execute a script, causing the server to...

How to resolve 503 errors during data upload and import

503 Error: How to Handle Exceeding Server Limits A 503 error is a server issue that occurs when...

I can't access my own pages, but others can

If you find that you are unable to log in to cPanel with us or see your own pages while others...

Script for cleaning up Node.js processes that lock your web hosting

This script should run as a cron job on your cPanel web hosting account. This is not the perfect...