How to Enable Debug and Error Reporting in Joomla 4 and What Does it do?

In our last article, we have discussed how to enable content versioning in Joomla. And today we are going to learn how to enable Debug and error reporting in Joomla 4.

Debug in Joomla 4 is very powerful and important when it comes to figuring out what’s going on with blank pages and or other errors within your Joomla site.

Here is our default Joomla screen.

How to Enable Debug and Error Reporting in Joomla 4 and What Does it do?

I am going to create an error in one of the Joomla files and we will use the debug and error reporting to navigate and fix through the error.

To create an error. I am going to open up the index.php file and write anything down that’s isn’t valid PHP code.

How to Enable Debug and Error Reporting in Joomla 4 and What Does it do?

After saving the file, if I try visiting the frontend of the website, we should see the blank page:

How to Enable Debug and Error Reporting in Joomla 4 and What Does it do?

Let’s go ahead and enable error reporting real quick and we should start seeing our errors here:

To enable error reporting: Navigate to System >> Global Configuration.

How to Enable Debug and Error Reporting in Joomla 4 and What Does it do?

Inside the Global Configuration screen, click the Server tab. And then change error reporting to Maximum (your current value might be System Default or none).

How to Enable Debug and Error Reporting in Joomla 4 and What Does it do?

Once done, hit Save.

Now go back and refresh the frontend and you should see an error similar to the one below.

How to Enable Debug and Error Reporting in Joomla 4 and What Does it do?

This is very useful for PHP fatal errors where Joomla isn’t able to run at all and you have to fix beforehand in order to even see the Joomla screen working.

Sometimes, you may start experiencing blank or broken pages after installing an extension or upgrading/downgrading PHP version on your server or some similar change, to debug errors like those the Joomla debug would be very very useful.

To create an error like that, I am going to modify the file templates/cassiopeia/index.php.

I am going the following one from

use Joomla\CMS\Factory;

To

use Joomla\CMS\Factory1;

This is just a very small change that calls for a Library that doesn’t exist (just like your outdated extension might be calling for depreciated or removed Joomla code).

Now, immediately after making this change, If I go ahead and refresh the homepage of my website, I can see the following error screen:

How to Enable Debug and Error Reporting in Joomla 4 and What Does it do?

You can see Joomla notifying an error but not much info about where the error is appearing from, this can be very frustrating when working with extensions, where they have hundreds of files but we don’t see an exact location of the file that is causing the error.

The debug in Joomla is very useful at this point.

Go ahead and enable the debug using the System >> Global Configuration >> System tab.

How to Enable Debug and Error Reporting in Joomla 4 and What Does it do?

Hit Save refresh the frontend.

You will see a whole trace log of the file that is causing the error and how Joomla got to that file.

How to Enable Debug and Error Reporting in Joomla 4 and What Does it do?

You can now go to the exact file and add your fix. That’s it, debug and error reporting can be very useful when it comes to debugging blank pages or other Joomla errors.

Naveen
Naveen is a versatile professional with expertise in Product Management, Marketing, QA, and Client Management. He brings a strategic approach to his work, combining technical insights with creative problem-solving to drive impactful outcomes. Outside of work, Naveen enjoys writing poetry and traveling, finding inspiration in words, cultures, and new experiences.
I’ve had the great pleasure of hiring JoomDev for several projects over 8 years. The team brought our ideas to life and created the customized application that we only imagined in our minds. We appreciate JoomDev “can do” attitude and co-operation to complete any task until being fully satisfied. Hire JoomDev, you’d be crazy not to!
photo-alex
Alex Shvarts
Fundkite

Contact Sales