How can I turn the debug bar on? |
Frustration is a big part of coding. I'd recommend wine, beer or something stronger, as required.
Any error/exception being thrown will break the toolbar if it stops script execution. Your problem has to do with the paths that have (or have not) been correctly set somewhere, either in the CI framework, or in your server set-up (in one of the config files)... it may even be a problem in one of the .htaccess files (though that is probably an outside chance). Also, whatever webserver you're on will have a lot of header-setting options that can be applied outside of the CI framework to tighten or relax security). I'd suggest starting to look in App.php - there is a $baseURL variable spec'd there... and to get it working, perhaps checking $CSPEnabled=false is set (which I think is probably the default) - the idea is you want to have those two paths (in your cut&paste) the same (first prize), OR the CORS policy to be relaxed (as a temporary measure so you can work with the code). Also, if need be, if you're using a local server (which I'm guessing you are, based on some of the cut&paste above), you can play with a remapping in your operating system's HOSTS file if necessary.
Rename env to .env and add CI_ENVIRONMENT = development
And then in app/Config/App.php put correct baseUrl... for example app.baseURL = "http://localhost/your-project/public/" and I'm sure debug toolbar will start to work ![]() (04-29-2020, 05:36 PM)Gary Wrote: Frustration is a big part of coding. I'd recommend wine, beer or something stronger, as required. Haha, SURE! Old timer coder here so I year ya... unfortunately no alcohol around... ![]() (04-29-2020, 05:36 PM)Gary Wrote: Any error/exception being thrown will break the toolbar if it stops script execution. Cool, that's a great tip. I will check my configuration files and paths and see what happens. I'll update this thread accordingly with my improvements (or more frustrations). ![]()
Recovering the wasted time...
(04-29-2020, 05:36 PM)Gary Wrote: I'd suggest starting to look in App.php - there is a $baseURL variable spec'd there... and to get it working, perhaps checking $CSPEnabled=false is set (which I think is probably the default) - the idea is you want to have those two paths (in your cut&paste) the same (first prize), OR the CORS policy to be relaxed (as a temporary measure so you can work with the code). Gary, you absolutely nailed it. Believe it or not the problem was fixed in my very first attempt! I opened the app.php file and went directly to $baseURL. There I realized that it was configured to point to 'http://localhost/curso-codeigniter4/'. The problem is that I already had configured before my local server (XAMPP) to a virtual host called 'http://curso-ci4/'. Long story short, as soon I changed $baseURL to point to the virtual host it worked instantly in the very first F5 stroke. Now I have the small flame at the bottom right bar of my screen and all the odd errors in console has vanished! ![]() Thanks for the detailed instructions! ![]()
Recovering the wasted time...
Hello,
I am discovering CodeIgniter and would like to use it for my app so began tutorial and all worked fine until I have the same problem (no debug bar). I have checked my files for all that is mentionned here, but all seems to be ok : In .env : CI_ENVIRONMENT = development app.baseURL = 'http://localhost' In App.php : $baseURL = 'http://localhost:8080' In htacess files : I found nothing about CI_ENVIRONMENT In Filter class (globals array) : 'toolbar' is uncommented. CI development server is started at http://localhost:8080. Nevertheless my browser console indicates that message : GET http://localhost/index.php?debugbar net::ERR_CONNECTION_REFUSED Can you please tell me what's going wrong? Thank you in advance. :
If it is a CORS problem you can add this to your .htaccess file for now, better ones are in the works.
Add it under RewriteBase / Code: ## .htaccess Control For CORS Configuration Change https://yoursite.com to your website.com What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(02-17-2023, 02:24 AM)InsiteFX Wrote: If it is a CORS problem you can add this to your .htaccess file for now, better ones are in the works. Thank you InsiteFX. I have added those lines but nothing has changed.
go to .env file
Code: CI_ENVIRONMENT = development Code: app.baseURL = 'http://localhost/<your project folder name>/' only run using http Code: app.forceGlobalSecureRequests = false set the permission for writable folder. Code: chmod -R 775 writable run the dev server by, Code: php spark serve if it is not showing, commented it Code: #app.baseURL = '' !! Make sure you remove the # before setting the above variables and the app is running in port 8080 |
Welcome Guest, Not a member yet? Register Sign In |