I am getting an error like this in the backend running my own extension:

Call to a member function setQuery() on null

And because I am not clairvoyant I do need some more info about where the error happened.

Can I somehow disable Joomla's own way of displaying errors and getting the real PHP error shown where I can see in what file and line the error happened?

I only need the full and real error reporting in the backend and not in the frontend of the site.

I have inserted this in my extension:

ini_set('display_errors', TRUE);

And it does gives PHP errors in some cases but in this case it is hard to know what line is make the error because of Joomla all too simple layouted error reporting. I better like a non-layouted page with a usable error reference :-)

  • Is it coming wrong code you've written yourself? If so, can you provide the code?
    – Lodder
    Commented Apr 21, 2017 at 9:30
  • Hi Lodder :-) I have written 10.000 lines of PHP in different files so it is not an option to paste it here. I just need to make Joomla give a real error reference.
    – Jens Kirk
    Commented Apr 21, 2017 at 9:48
  • Doesn't matter how many lines of code you've written :) Do a search for setQuery which is associated Joomla's database queries. At a wild guess, I think you may have missed out $db = JFactory::getDbo(); at the beginning of 1 or more of your queries
    – Lodder
    Commented Apr 21, 2017 at 9:51
  • I have done a seach like that and have not found the place... yet.
    – Jens Kirk
    Commented Apr 21, 2017 at 10:00
  • Go to your Global Configuration in the Joomla backend and set error reporting to Development
    – Lodder
    Commented Apr 21, 2017 at 10:10

1 Answer 1


Try looking at your server's PHP error log files - they should be reporting the full error message, or can be configured to do so.

In Joomla, you can get addtional info by going to system - global configuration - system and turning on Debug System (the Call Stack should then point you towards the problem module/component), and also set server - error reporting to Development. Depending on the type of error, this will usually point you to the right line.


One further thing that should work - go to /templates/system/error.php (frontend) or administrator/templates/system/error.php (backend) and add the line

<?php print_r($this->error);?>

This should dump out all the info the error message page has. If the template you are using has an error.php file, then you'll need to add it there instead.

Undo this after you have finished, though.

  • Setting it to "Development" and cleaning all kind of cache on client and server still only gives me this: An error has occurred. 0 Call to a member function setQuery() on null Return to Control Panel
    – Jens Kirk
    Commented Apr 21, 2017 at 10:25
  • What does your PHP error log say?
    – RichardB
    Commented Apr 21, 2017 at 10:29
  • Updated my answer in case you don't have an error log / access to fiddle with PHP settings.
    – RichardB
    Commented Apr 21, 2017 at 10:35
  • I am using the default admin template and I have insert the print_r-line ind the admin error php page but it does still only show the very simple layouted joomla error. What to do? :-)
    – Jens Kirk
    Commented Apr 21, 2017 at 11:46
  • If "default admin template" - you mean ISIS, then you'll need to add the message at administrator/templates/isis/error.php - and add it in the body of the html.
    – RichardB
    Commented Apr 21, 2017 at 11:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.