You might have seen the “Error Reporting” field in your Joomla Configuration Settings, and you might have wondered what it is. In short, the “Error Reporting” field is responsible for controlling the display of errors on your Joomla website. In this post, we’ll discuss what should be the default error reporting on your website, when to change the error reporting level, and what does each and every error reporting level mean (and do).
What should be the default error reporting on your Joomla website?
On any production Joomla website, the error reporting that should be used is “None”. This means that no errors are displayed on your website, regardless of the default settings on your hosting account. Preventing errors from being displayed on your production Joomla website is critical for the security of your website. This is because errors displayed can reveal some critical information about your website, including, but not limited to: the absolute path of your website (such as /var/hosts/youraccountname/public_html/yourjoomlawebsite), MySQL queries sent to your database server (revealing part of your database structure), the type of extensions you’re installing, etc… Some errors might reveal very critical information such as the database username and the database password. When Joomla is first installed, its default error reporting is “System Default”, this means that any error reporting in the global (or local) php.ini file will be inherited by your Joomla application. So, if the error reporting in the php.ini file is E_ALL, then the error reporting on your Joomla website will be E_ALL (which means that all the errors will be displayed to your visitors) – needless to say, the first thing that you need to do when you make your Joomla website live is changing the error reporting to “None”.
When to change the error reporting?
The error reporting should be changed from “None” to anything else only when you are seeing a blank page on your website and/or you are debugging your website. When doing so, we recommend that you create a condition in the index.php file to show the website’s content only for your IP (visitors to your website should see a blank page). This will ensure that only you will be able to see the errors on your website. Once you see the errors on your website, you should fix them, and then change the error reporting back to “None”.
What does each and every reporting mean?
Here are all the error levels on Joomla, along with a description:
- None: All errors are suppressed. When you set the error reporting to “None”, then no errors are shown whatsoever on the website – except when 3rd party extensions override the Joomla error reporting settings with their own settings.
System Default: Joomla will inherit the error reporting from your php.ini. So, if php.ini’s error_reporting variable is set to E_ALL and the display_errors variable (in php.ini) is set to 1, then Joomla will display all the errors on your website (not good!).
Simple: Joomla will display only the warnings and the fatal errors on the website (regardless of what the error reporting level in the php.ini file is). Basically all errors will be displayed with the exception of the notices.
Maximum: Joomla will display all the errors, warnings, notices, deprecated functions calls, and strict standards on the website (again, Joomla will ignore the settings in the php.ini file). Note that when you display the notices/deprecated function call/strict standards you may break pages that were already working before.
Addendum: How to manually change the error reporting in the configuration.php file
Sometimes, it’s more fun/convenient/expedient/practical to change the error reporting in Joomla’s configuration.php file directly (without using the interface). This will allow the administrator to have a more granular control over the level of errors that s/he wants to see on the website.
The important thing to remember here is that the value of the $error_reporting in the configuration.php file is the numerical value of PHP’s error constants (such as E_ALL, E_WARNING, E_NOTICE, etc…). See the below:
|$error_reporting||PHP equivalent||Errors displayed on the website|
|32767||E_ALL | E_STRICT||All errors, warnings, notices, and strict standards|
|30719||E_ALL||All errors, warnings, notices|
|30711||E_ALL & ~E_NOTICE||All errors, warnings, but no notices|
|30711||E_ALL & ~(E_NOTICE|E_WARNING)||All Errors. No warnings or notices.|
|-1||0||No error reporting at all.|
Note: Some PHP versions differ in how error constants are evaluated. For example, for PHP versions that are >= 5.4.0, E_STRICT is part of E_ALL. If you want to know the actual $error_reporting value for your environment, it’s better to create a test.php file where you echo the value of your error reporting (for example:
echo(E_ALL);), upload it to the server, and see what it prints.
If you’re having problems with your Joomla website and you need help, then all you need to do is to contact us. We’re very helpful, we’re always available, we’re very experienced in PHP and in Joomla, and we’re very friendly. Our services are reasonably priced too! What more could you want?