debug_kit icon indicating copy to clipboard operation
debug_kit copied to clipboard

DebugKit not showing on fresh CakePHP 5 installation

Open abelini opened this issue 1 year ago • 16 comments

After a fresh CakePHP 5.0.5 I activated DebugKit by adding this code to Application.php

    if (Configure::read('debug')) {
        Configure::write('DebugKit.safeTld', ['mydomain.net']);
        Configure::write('DebugKit.forceEnable', true);
        $this->addPlugin('DebugKit');
    }

I've set 'debug'=>true, in app_local.php as well.

On the default CakePHP it says that DebugKit is loaded and can connect to the DB, however I'm getting the error in the image.

Error_image

If I comment the line:

//Configure::write('DebugKit.forceEnable', true);

I can have the error gone but DebugKit still not loading.

What is it wrong here?

abelini avatar Jan 15 '24 20:01 abelini

The debug_kit will automatically be enabled if you have the debug_mode enabled due to how its configured in your config/plugins.php

You don't need to add it again in your Application.php

The fact that you get this error template means you have at least the debug mode enabled.

Anyway I am not able to reproduce your problem. Please make sure your PHP has the sqlite extension enabled and that your sqlite library is not too old.

I am using PHP 8.1.26 and SQLite 3.44.0 (check via php -i | grep SQLite)

LordSimal avatar Jan 15 '24 20:01 LordSimal

What version sqlite is on your system?

othercorey avatar Jan 15 '24 22:01 othercorey

You don't need to add it again in your Application.php

Well you're right about that.

I'm using PHP 4.2.14 and

PDO Driver for SQLite 3.x => enabled SQLite Library => 3.7.17 SQLite3 support => enabled SQLite Library => 3.7.17

The weird thing is that I have other 3 projects running Cakephp 4.5.x in the same server (VPS), only this installation (v5.0.5) throws the error.

abelini avatar Jan 16 '24 01:01 abelini

Sqlite 3.7 is a very old release.

othercorey avatar Jan 16 '24 01:01 othercorey

I'm using PHP 4.2.14 and

What???

ADmad avatar Jan 16 '24 02:01 ADmad

I'm using PHP 4.2.14 and

What???

8.2.14 sorry... And just upgraded to 8.3.1 and got more errors

Warning: You should set `zend.assertions` to `1` in your php.ini for your development environment. in /home/autumnws/public_html/labs/jaramillo/vendor/cakephp/cakephp/src/Core/Configure.php on line 102
Warning (2) : Undefined array key "origin" [in /home/autumnws/public_html/labs/jaramillo/vendor/cakephp/cakephp/src/Database/Schema/SqliteSchemaDialect.php, line 339]
Warning (2) : Undefined array key "origin" [in /home/autumnws/public_html/labs/jaramillo/vendor/cakephp/cakephp/src/Database/Schema/SqliteSchemaDialect.php, line 354]
Warning (512) : Unable to emit headers. Headers sent in file=/home/autumnws/public_html/labs/jaramillo/vendor/cakephp/cakephp/src/Core/Configure.php line=102 [in /home/autumnws/public_html/labs/jaramillo/vendor/cakephp/cakephp/src/Http/ResponseEmitter.php, line 65]
Warning (2) : Cannot modify header information - headers already sent by (output started at /home/autumnws/public_html/labs/jaramillo/vendor/cakephp/cakephp/src/Core/Configure.php:102) [in /home/autumnws/public_html/labs/jaramillo/vendor/cakephp/cakephp/src/Http/ResponseEmitter.php, line 159]
Warning (2) : Cannot modify header information - headers already sent by (output started at /home/autumnws/public_html/labs/jaramillo/vendor/cakephp/cakephp/src/Core/Configure.php:102) [in /home/autumnws/public_html/labs/jaramillo/vendor/cakephp/cakephp/src/Http/ResponseEmitter.php, line 192]

abelini avatar Jan 16 '24 04:01 abelini

This was added in https://github.com/cakephp/cakephp/pull/17256

@ndm2 Do you know the required sqlite version required for this?

othercorey avatar Jan 16 '24 07:01 othercorey

Do you know the required sqlite version required for this?

From the PR

It should be noted that the FK handling changes would require at least Sqlite 3.16.0

ADmad avatar Jan 16 '24 07:01 ADmad

I think we should add a version check in the sqlite driver and throw an exception which devs can understand.

ADmad avatar Jan 16 '24 07:01 ADmad

Missed the very last sentence. We can update the 5.0 migration docs and add a version to the database list (although no one reads that).

othercorey avatar Jan 16 '24 07:01 othercorey

I probably should've thought of a possible version based exception, sorry, I didn't really anticipate people using 6+ years old Sqlite versions, let alone 10 year old ones 🙃

ndm2 avatar Jan 16 '24 10:01 ndm2

Well, that's the problem, maybe it's a good idea to state the minimal version of all the needed stuff. In my case, I couldn't upgrade SQLite so I had to connect to a Mysql DB and that solved the problem.

abelini avatar Jan 16 '24 20:01 abelini

I am just curious now: What OS are you running so that a PHP 8.2 installation can live parallel to such an ancient sqlite library... This probably isn't Docker or any Debian based system.

LordSimal avatar Jan 16 '24 20:01 LordSimal

I am just curious now: What OS are you running so that a PHP 8.2 installation can live parallel to such an ancient sqlite library... This probably isn't Docker or any Debian based system.

PHP 8.3 lol... And it's a CentOS server

abelini avatar Jan 16 '24 22:01 abelini

CentOS

It's always CentOS with such issues. It's an abomination of a distro. In the past too we had to deal with numerous reports from CentOS users because it had very outdated ICU libs.

ADmad avatar Jan 17 '24 02:01 ADmad

Did you try running a docker container setup and see if that works? Instead of using the native PHP/SQL stack on your system?

On my linux mint I for example use https://github.com/cytopia/devilbox which out of the box works with CakePHP and is much more easy to configure than a local system would be, especially in your case. I never had any issues here, especiallly not with DebugKit. Just an idea.

dereuromark avatar Jan 26 '24 00:01 dereuromark

If there is not much more there can be done, I wonder if we should close.

dereuromark avatar Mar 02 '24 21:03 dereuromark