How to disable PHP error logs

Search another help topic

By default, PHP errors and warnings generated by your websites are logged in error_log files in the directory where your PHP files are located. The PHP error_log files can grow to a large size.

If you do not need the error_log file you can disable PHP error logging using one of the three ways listed below:

PHP Selector in cPanel — Recommended

  1. Log in to cPanel.
  2. Click Select PHP Version.
  3. Click Switch To PHP Options
  4. Set log_errors to Off
  5. Click Save

.htaccess

  1. Edit .htaccess in your public_html folder
  2. Enter the following code:
    php_flag log_errors off
  3. Save the file.

php.ini

  1. Create a new file named php.ini in your public_html folder.
  2. Enter the following code:
    log_errors = off
  3. Save the file.

Verify your changes

Create a phpinfo php page to check your settings are active.

Delete existing PHP error_log files

  1. View your webspace using FTP or cPanel File Manager
  2. Select your error_log file
  3. Delete

Need help with this?

Open a ticket and link to this guide so our team can see what you have tried.

View support tickets

Power your business with Ecenica Hosting

Built for WordPress and serious websites. Fast, secure and supported by real people in the UK.

Ecenica hosting services represented by a connected red route across London