Welcome Guest, Not a member yet? Register   Sign In
How to enable debug toolbar in CI4.0.0-rc.3
#21

(01-17-2020, 12:55 PM)littlej Wrote: Hello mate ! I had a similar issue before, using CI in a subfolder. What does your browser's console says ? Unable to reach some files ?
In a local environment, set your base_url to "http://localhost:8080/", then in your console launch "php spark serve". Is it working now with your app ?

Hey Littlej, I had initially thought your post had ended up in this thread by accident... in part because it was replying to my post that said I'd manage to work around the problem... but the missing debug toolbar problem has come back... and in my searches for possible fixes, I see that Hbonds has another thread that also points to subfolder's being a problem (https://forum.codeigniter.com/thread-751...t=debugbar).

My installation has CI just above the root of my base_url (which, I believe, is the default location, so I've never experienced files not being found)... and the base_url has always been set in App.php (and never given any issues in terms of locating resources).  I have also tried setting it (the same as what's set in App.php) in the .env config file (which was previously commented out)... just in case (with and without the port.  I'm using the HTTP default, 80, though I did try your 8080 suggestion too, in the event there was something that I was missing (and which seems to be the default port set CI’s Serve.php)).

After some experimentation, I find that if I use the redirect()->to(base_url().'AnyController/anyMethod'); command to redirect to ANYWHERE other than the (plain) base_url(), even if it’s to a controller set in \Config\Routes.php, then on the new page (even a simple/essentially empty page, that doesn’t have anything that could cause a problem), the toolbar has disappeared.  The JavaScript for the toolbar (toolbar.js) doesn’t seem to get loaded… which is why it doesn’t have the bar injected into the DOM to be displayed (but I’ve not figured out why, as yet).

… so any other ideas/suggestions would be appreciated.

Thanks,
Gary
Reply
#22

(This post was last modified: 01-19-2020, 10:53 AM by littlej.)

Hello ! Yes, that is exactly what I am talking about. I had this thread in mind too.
It doesn't matter where you CI is placed on the server, it is the final url which is important. And, in your previous messages you said "www.domain.com/projects/CI4/".
What's happening if you add "?debugbar" to your url ? Ex: http://localhost:8080/?debugbar

PS: The port is not important. I just wanted you to use "php spark" and CI's default settings, in order to have the "standard" configuration, and be sure this is not coming from your custom settings.
Reply
#23

You have to set $indexPage to '' (blank)
Reply
#24

(01-19-2020, 10:48 AM)littlej Wrote: Hello ! Yes, that is exactly what I am talking about. I had this thread in mind too.
It doesn't matter where you CI is placed on the server, it is the final url which is important. And, in your previous messages you said "www.domain.com/projects/CI4/".
What's happening if you add "?debugbar" to your url  ? Ex: http://localhost:8080/?debugbar

PS: The port is not important. I just wanted you to use "php spark" and CI's default settings, in order to have the "standard" configuration, and be sure this is not coming from your custom settings.

Hi Littlej,

The "www.domain.com/projects/CI4/" path is from Hbonds' post... I believe my layout and settings are as standard as they come (?):

/project / app (containing standard CI layout with Config/Controllers/Database etc folders)
             / openssl
             / writeable
             / system
             / public / index.php <-- base_url() => Apache's DocumentRoot
                         / .htaccess
                         / ... etc
                         / assets / ... etc

I had tried your "?debugbar" suggestion, thank you... but I get another plain-text-only webpage opening in a new window what seems to show the code of the debugbar function (it starts off like this:  document.addEventListener('DOMContentLoaded', loadDoc, false); function loadDoc(time) { if (isNaN(time)) {.... ).   Although the whole site's interface is JavaScript-based, I don't believe there is anything that should cause it to open and display a new page in my code (?).

I'm on a Windows platform, where I don't think PHP Spark is an option.

I wonder whether there is somehow a connection to this redirect() problem experienced by other folk, even though it only seems to be a path-related issue in this (and linked) posts:  https://forum.codeigniter.com/thread-75223.html... or is this just me grabbing at straws?

Gary
Reply
#25

(This post was last modified: 01-19-2020, 03:06 PM by littlej.)

Hey !

1/ If you get this code with "?debugbar", this means you have access to the debugbar (but it is not showing)
2/ "php spark" is working on all OS, I use it on Windows, Linux and Mac.
3/ What is your base_url() then ? This is THE important thing to know :-) is it "http://localhost/" or "http://localhost/some/subdir" ?
4/ You are using WAMP, right ? If yes, there are VERY low chances you are at the root of the domain ("http://localhost/"), which could be the issue,. That is why you should try to make "php stark" work (instead of WAMP), or keep WAMP but try to set up a virtual host.
5/ To be sure... in the view (the homepage for instance), if you add "<?= ENVIRONMENT ?>" does it says "development" ?

PS1: In order to get "Spark" working, you need to use Composer: https://getcomposer.org/doc/00-intro.md#...on-windows .
PS2: Set up a virtual host using Wamp: http://codedecode.co.in/blog/wordpress/s...with-wamp/  . If you set up a virtual host, the goal is to have something like "http://fakedomain/" but not "http://fakedomain/some/other/dir". Try to get rid of subfolders. (This is why I use "spark", it is easier, and cross-platforms).

FYI, here is what M. Gatner wrote on Slack the 15th of January 2020 (just saw it right now):
Code:
The framework expects baseUrl to point to the served root, not accommodate the directory structure. You should set your host to serve codeigniter4/public as the root, and adjust your baseUrl to be just “/”. If for some reason you can’t make that change I’ve read on the forums of people approximating it with an .htaccess file - maybe look for one of those threads for guidance.
Reply
#26

Hi Littlej,

Been away, and off this project since I’ve been back… though, subsequent to my departure, I did find that my debugbar mysteriously returned, with only the occasional, and very brief, absence… all without my doing anything about it.

Relating to your points:

1)  I think you were right about the debugbar still being accessible (but not showing)… it is quite likely that something in my Ajax code (a large proportion of the site is Ajax-driven, so there’s probably a lot of scope for something in my code to have disrupted the debugbar).

2)  I did start looking into Stark (Spark?)… but didn’t get very far into it, primarily because I couldn’t seem to find what seemed to be a good starting point… there were a few GitHub pages on Stark (Spark?), but nothing that immediately appeared useful.  I’d be grateful if you could suggest a good place to start.  I’ve just checked again, and find this site, that I didn’t come across before: https://php-download.com/package/spark-php/spark.  Is this the one you’re talking about?

3)  I’m running my site on the (local) https://pig.pen which Apache maps directly to the project root: "C:/xampp/htdocs/project_dir/public".

4)  At the moment I am on XAMPP, using a VirutualHost on 443.

5) Yes, ENVIRONMENT is definitely development.

At any rate, the problem has disappeared for the moment.

Regards,
Gary
Reply
#27

On Windows you also need to edit the windows host file.

c:\Windows\System32\drivers\etc\hosts

Then you can add

::1 or 127.0.0.1 yoursite.local etc;
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#28

@Gary I think you should now update to version 4.0 that has been officially released today. Regarding "Spark", you don't need to look at the documentation, the CI team did it and set it all up for you :-) You can just use it by following this instructions: https://codeigniter4.github.io/userguide...ent-server
You will use Apache or Nginx on your production server.
Reply
#29

(11-15-2019, 09:15 PM)kilishan Wrote: Ensure that the baseURL set in Config\App matches where you're hosting it. I'll have times hosting it through "spark serve" where I didn't end the last session cleanly so the port is already taken, switch to another port, and forget to change my baseURL.
I changed the baseURL and that solved the problem, te toolbar finally appeared!!! Thanks
Reply




Theme © iAndrew 2016 - Forum software by © MyBB