5

There are many times that I need to debug issues on the administration area of Joomla and need to do so on the live site. But I don't want to enable error_reporting also for the front-end. Is there anyway to enable error_reporting only for the admin ?

6

Try this small Plugin from Viktor Vogel. This plugin gives the possibility to control the reporting per user group. Big advantage of this is, that you don't need to hack core files.

http://joomla-extensions.kubik-rubik.de/eer-easy-error-reporting

  • This is great, but you should make sure it is the first plugin called or it will not catch errors. If you still don't see errors but get something obvious like a white screen then you should turn on global configuration to see the error. – Eoin Jun 12 at 16:43
3

My most convenient trick I use in this case, is by creating a temporary hack on the framework.php file, inside the

/administrator/includes/ directory.

The error reporting for the admin is handled in framework.php ~line 52.

// Set the error_reporting
switch ($config->error_reporting)
{
    case 'default':
    case '-1':
        break;

    case 'none':
    case '0':
        error_reporting(0);

        break;

Make the following changes:

// Set the error_reporting
switch ($config->error_reporting)
{
    case 'default':
    case '-1':
        break;

    case 'none':
    case '0':
        error_reporting(E_ERROR | E_WARNING | E_PARSE);
        ini_set('display_errors', 1);
        //error_reporting(0);

        break;

After debug is done, I revert back these changes.

  • 1
    I have to admit, this is a feature that should be integrated into the Global Configuration. – Lodder Nov 10 '14 at 10:50
  • So will this show error reporting for each admin user on can it be user-specific? – jonboy Nov 10 '14 at 11:29
  • @johnny_s, It will display errors for all in the backend. I don't think you can make such distinction at this point to enable error_reporting only for super user, but I might be wrong. - Joomla Agency, posted an answer with a link to a plugin for this. – FFrewin Nov 10 '14 at 16:01
  • @Lodder if you believe this, would you support a pull request if I made it? – Eoin Jun 8 at 13:21
  • 1
    @Eoin, thinking about it now, no. It should really be done at development level before a site goes live. Then again, that's my personal opinion. Others may feel differently – Lodder Jun 8 at 18:53
3

You can add an .htaccess file into administrator directory with:

php_flag display_errors on
php_value error_reporting <integer>

Ref: https://stackoverflow.com/questions/6127980/enabling-error-display-in-php-via-htaccess-only

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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