Welcome Guest, Not a member yet? Register   Sign In
How can I turn the debug bar on?
#1

I am using CI4 installed with Composer.
I checked this thread but it didn't work for me.
I have this set in .env file:

Code:
CI_ENVIRONMENT = development

Any idea?

Thanks!
Recovering the wasted time...
Reply
#2

(This post was last modified: 04-24-2020, 04:38 PM by Gary.)

Go to app\Config\Filters.php and make sure this line is uncommented:

'after' => [
'toolbar', // comment this out to disable the debug toolbar

You can also check in .htaccess (in the public folder) for CI_ENVIRONMENT... some of these similar settings override others, so having it set in one place doesn't always mean you get what you're expecting.
Reply
#3

(This post was last modified: 04-24-2020, 04:40 PM by YanKleber.)

(04-24-2020, 04:33 PM)Gary Wrote: Go to app\Config\Filters.php and make sure this line is uncommented:

'after'  => [
'toolbar', //  comment this out to disable the debug toolbar

It is... either in $aliases as well in $globals...

Here it is my Filters.php file:

PHP Code:
class Filters extends BaseConfig
{
    
// Makes reading things below nicer,
    // and simpler to change out script that's used.
    
public $aliases = [
        
'csrf'     => \CodeIgniter\Filters\CSRF::class,
        
'toolbar'  => \CodeIgniter\Filters\DebugToolbar::class,
        
'honeypot' => \CodeIgniter\Filters\Honeypot::class,
    ];

    
// Always applied before every request
    
public $globals = [
        
'before' => [
            
//'honeypot'
            // 'csrf',
        
],
        
'after'  => [
            
'toolbar',
            
//'honeypot'
        
],
    ];

    
// Works on all of a particular HTTP method
    // (GET, POST, etc) as BEFORE filters only
    //     like: 'post' => ['CSRF', 'throttle'],
    
public $methods = [];

    
// List filter aliases and any before/after uri patterns
    // that they should run on, like:
    //    'isLoggedIn' => ['before' => ['account/*', 'profiles/*']],
    
public $filters = [];


Any other idea?
Recovering the wasted time...
Reply
#4

Have you also checked .htaccess (particularly in the public folder)?

If you make any changes to some of these config files (including .env), you may also need to stop and restart the server to be sure they've been digested (though, I think the .htaccess in the public folder doesn't always seem to require this (?)).
Reply
#5

(This post was last modified: 04-24-2020, 04:54 PM by YanKleber.)

(04-24-2020, 04:47 PM)Gary Wrote: Have you also checked .htaccess (particularly in the public folder)?

If  you make any changes to some of these config files (including .env), you may also need to stop and restart the server to be sure they've been digested (though, I think the .htaccess in the public folder doesn't always seem to require this (?)).

I checked the .htaccess file but I really don't know what to change there. I tried to add to it (at the top) the line:

Code:
SetEnv CI_ENVIRONMENT development

But it didn't take ANY effect so I removed it.

And yes, I restarted Apache after all changes.

PS: I think it is not related to the issue, but... my pages are all rendered with "View Parser". I don't think the debugger is available only for whose render pages with plain View, is it?
Recovering the wasted time...
Reply
#6

(This post was last modified: 04-24-2020, 05:03 PM by Gary.)

SetEnv CI_ENVIRONMENT development <-- in .htaccess is good.

I stand under possible correction, but as far as I'm aware, it should show up regardless of how the page is generated (though, it doesn't get on-screen (only header) updates if one updates using JavaScript without a page update, or navigates TO the page using JavaScript).

If there are any framework exceptions being thrown (check in the network response tab for these), then it also breaks the toolbar.
Reply
#7

I see... well I really don't know what else try here...
Recovering the wasted time...
Reply
#8

If your code terminates with exit(); (vs return, or nothing) it will also stop the toolbar from showing up because this stops the script right there, as opposed to letting it continue (which is what is required for the after filters to work).
Reply
#9

Have you checked the network tab in your browser and see what kind of status code it returns? Normally it's a URL issue as you don't need to do anything more than setting it in .env (make sure there are an . dot). You need to set your baseURL correctly.
Reply
#10

Sorry, I stayed away for a while studying CI and was a bit frustrated with the debug bar thing. Today I made some tests and figured a couple things.

I realized that the debugger is throwing the following two errors in console (in EVERY page of my project):

PHP Code:
Access to XMLHttpRequest at 'http://localhost/curso-codeigniter4/index.php?debugbar_time=1588198772' from origin 'http://curso-ci4' has been blocked by CORS policyNo 'Access-Control-Allow-Origin' header is present on the requested resource.
index.php?debugbar:59

GET http
://localhost/curso-codeigniter4/index.php?debugbar_time=1588198772 net::ERR_FAILED 

If I comment the 'toolbar' line under $globals in Filters.php the error goes away. I think it may be related.

Any idea?
Recovering the wasted time...
Reply




Theme © iAndrew 2016 - Forum software by © MyBB