The “error_log” File in the Root of Some Joomla Websites – What Is It?

There are some Joomla websites that have a file called error_log in their root directory (e.g. directly under public_html). For some websites, the error_log file is a several hundred megabytes in size and it grows by a few megabytes everyday. So what is this file and is it necessary to have it?

Let’s start with explaining what this file is. The error_log file contains all the errors that happen on your Joomla website. Some of these errors are visible to your users, such as fatal errors, and some aren’t, such as missing an Apache module (quick note: Apache modules are not the same as Joomla modules – they are completely different things). The error_log file contains every error, the time it happened, and the page where that error happened (again, it might be that the error is invisible to the end user, in other words a system error).

So, what’s the point of having this file?

This file is extremely helpful – it contains every error that happened on the Joomla website, where it happened, and when it happened. The purpose of having this file is to help you fix the errors that occur on your Joomla website. It is also very helpful to catch some potential exploits before the real exploit, since malicious attacks generate a lot of errors before they succeed.

But, won’t others be able to read/download that file file by just going to http://yourjoomlawebsite.com/error_log?

Unfortunately they can, but there are several ways to address that, one of them is just to block access to that file in the .htaccess file:

<Files "error_log">
     Order allow,deny
     Deny from all
</Files>

But what if I don’t want to have that file at all?

Disabling error logging to the error_log file is a very simple task, all you need to do is to add the following line to the beginning of your .htaccess file:

php_flag log_errors Off

So what’s the best practice? Is it to have this file or not to have it?

We think that having this file on your production website, but with disabled access to the public, is best practice. It’ll record all the errors that happen on your Joomla website giving you a chance to fix them, ultimately making your website better.

And what if I want to name that file something else?

Easy peasy! All you need to do is to add the following line to your htaccess file:

php_flag error_log /home/[website]/public_html/my_error_log.txt

Note that the above assumes that you are using WHM/cPanel as the backbone of your Joomla website. If you’re using Plesk, then the code would be something like this:

php_flag error_log /var/www/vhosts/[website]/httpdocs/my_error_log.txt

Now, if your error_log file is full of errors, and you need help fixing them, then why not contact us, we’re always here to help, we are fast, we are professional, our rates are affordable, and we are true Joomla experts!

5 Responses to “The “error_log” File in the Root of Some Joomla Websites – What Is It?”
  1. Comment by Brian — October 4, 2014 @ 8:51 am

    After I inserted:
    php_flag log_errors Off

    My website stopped loading pages. It comes back after commenting out that line. What do I do?

  2. Comment by Fadi — October 4, 2014 @ 9:23 am

    You can’t use this solution if PHP is not compiled as an Apache module (sorry for not mentioning this in the post).

    What you need to do is to create a php.ini or a .user.ini and add the following lines (only if your PHP version is at least 5.3):

    [code]error_reporting = off
    log_errors = off[/code]

    Please confirm if that helps.

    (Note: Some hosts don’t allow you to override the php.ini file).

  3. Comment by Fran — November 5, 2014 @ 8:28 am

    Now it works fine. I added:

    [code]error_reporting = off
    log_errors = off[/code]

    into a php.ini .

  4. Comment by Masvil — March 31, 2015 @ 9:05 am

    Great article, thank you!

    For me it worked only using .user.ini creation option (Joomla 1.5.18 + VirtueMart).

  5. Comment by Dentoo — January 17, 2019 @ 3:36 pm

    The solution to the irritating issue when you have your Joomla root error_log full of the following error (or similar error messages):

    PHP Strict Standards: Non-static method JLoader::register() should not be called statically in ...

    is creating a php.ini file with:

    error_reporting = off
    log_errors = off

    and dropping it in both root and /administrator folders of your Joomla site.

    Solved my problem!

    Thank you!

Leave a comment