PHP, WHM - Plesk - CWP

Turning Off Error Log on the Server

You can follow the steps below to prevent error log files from being created on your server. It can cause disk problems on some systems because it takes up too much space.

First, we connect to the server as root via SSH. We open our httpd.conf file with the following command. (The location may be different for you.)

nano /etc/httpd/conf/httpd.conf

After opening httpd.conf, find the place that says ErrorLog “logs/error_log”

#ErrorLog "logs/error_log"

change it as above and save it. (i.e. we make it passive by putting # in front)

In order for the operation we have done to be active, we reset httpd by writing the following command on the command line.

service httpd restart

After these operations, the error log will be closed.

Instead of closing the error.log, it would be healthier to fix the faulty sections in your system.

If you want to do this for a single site on your server, you can add the following line to the php.ini file.

error_reporting = off

or

error_reporting = E_ALL & ~E_DEPRECATED

Also one last tip, you can clear all error.log files on your server with the help of the following command.

find /home/*/public_html -name ‘error_log*’ | xargs rm -rf

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top