Where's debug kit?

As someone who is not consistently using cake year after year… I always come back after 1-2 years for a new project, download the latest version… and… everything seems broken relative to how it used to be. Meanwhile, the docs are still as unclear and incomplete as ever.

It’s very very hard to stay in love with this platform.

With that out of the way: I have a baked controller + view that’s not showing any records (all the other tables have records showing in their views). I looked at the bottom of the page to try to find the trusty cake icon to debug the query to help me figure out why it’s not pulling data… and… nothing.

An hour later and it sounds like what I want is debug_kit. I guess this isn’t enabled by default anymore. Ugh.

I followed directions to enable it. Nothing. Hm…… must be this bit here about sqllite… since I’m on a VPS where I’m not entirely in control… installing sqlite may or may not be an option but it’s a rabbit hole I’d rather not go down because that means another 3 hours gone before I even find out if this is going to work and whether it’s actually the answer I’m seeking.

So I tried setting up a ‘debug_kit’ datasource in config/app.php as per the docs… still nothing. Am I doing the right things or is there something I’m missing? How do I get the freakin queries to show up on each page load?

/question

Incidentally, meanwhile I’ve been doing battle with caches that are making development near impossible. I thought under debug mode (development) cake doesn’t use caching? I guess that changed too.

This is all terribly frustrating and the worst part is I do some version of this dance every single time I come back to cake. How is it possible this platform keeps changing so much? It should have been pretty damn mature by 4 years ago already.

/rant

What cake version are you using?
Debug loads now from Application bootstrap() function:

$this->addPlugin(\DebugKit\Plugin::class);
//and if you are trying to use it from a online production domain url you need use this config key before load:
Configure::write(‘DebugKit.forceEnable’, true);

Read the migration guides to stay up to date with the changes:
https://book.cakephp.org/3.0/en/appendices/3-x-migration-guide.html

1 Like

I’m on the latest 3.7 release.
The last time I used cake I was on 3.2

debugKit can be dangerous and leak confidential info if you use it in stage/prod env thats why its disabled for security reasons

cake cache in debug is set in app/config/bootstrap.php at 5.x · cakephp/app · GitHub
you might have also browser cache you can disable ie. in chrome in dev tools in Network tab check Disable cache checkbox
there is also possiblity you have opcache enabled and depending on your host you might be able to disable it by editing php.ini

php as language is evolving so are apps/frameworks

1 Like

DebugKit has needed sqlite since 3.0 was released.

When setting up the datasource, are you getting any errors? I assume you followed this guide: Debug Kit - 3.10.

Cake 3.0+ has always used caches, but the default bootstrap set the cache timeout to a couple of seconds when debug was enabled. This part hasn’t changed. It is possible that your application no longer has this switch?

How is it possible this platform keeps changing so much?

Well, the entire PHP ecosystem is rapidly evolving. 4 years ago, PHP 7 wasn’t on the horizon and Composer was only just starting to gather steam.

There is very little fundamentally different between 3.7 and 3.2, various APIs have been cleaned up, things have been deprecated, but most stuff still works the same.

Am I doing the right things or is there something I’m missing?

Since it’s not working, I can only assume that you are missing something :slight_smile: Hard to say what though, could you post your app.php and other relevant files?

1 Like

I was not able to use Composer this time and downloaded the latest version from GitHub. I’m guessing Composer is supposed to set up sqlite and that is why it worked for me before but not now. However that wouldn’t quite explain why it’s not working even after I set up a datasource for it in my MySQL database… nor why it would silently fail to load instead of throwing errors, considering I set it up per the Book’s instructions.

My problem is that the model caches seem to be extremely aggressive. The only way I can get things to work if I am also making changes to db table names and fields is by manually going into my tmp/caches and deleting all the files by hand. I wouldn’t expect such aggressive db schema caching on a development site and I’ve never had this problem in the past. Why this is happening now as opposed to before? Who knows.

Composer can’t install sqlite, it’s a PHP extension that needs to be installed at the OS level. Most likely you had sqlite installed previously, and don’t know.

Which link/download did you use? There is one that should work without composer, but via composer is the only officially supported Cake install method. For shared-hosting where shell access is not available there is the CakeDC Oven that gives you composer functionality without needing shell access.

Check that you have the following code in bootstrap.php

if (Configure::read('debug')) {
    Configure::write('Cache._cake_model_.duration', '+2 minutes');
    Configure::write('Cache._cake_core_.duration', '+2 minutes');
    // disable router cache during development
    Configure::write('Cache._cake_routes_.duration', '+2 seconds');
}

Maybe change the minutes to seconds.

1 Like