Isengo
Isengo

Reputation: 2073

CakePHP 3 debug_kit with subdirectory

Developed locally and transfered everything on the Server now. It works fine, but the debugkit is not showing properly.

I can´t access the js,css etc. So I am just seeing an empty box with a not loaded cake picture. The data is written in the database (I am using the standard connection and just inserted the panels and requests tables.

So my guess is this causes all that. Or that my App is installed in a sub/sub directory.

bootstrap.php

if (Configure::read('debug')) {
    Plugin::load('DebugKit', ['bootstrap' => true]);
}

app.php 'debug' => filter_var(env('DEBUG', true), FILTER_VALIDATE_BOOLEAN),

'debug_kit' => [
            'className' => 'Cake\Database\Connection',
            'driver' => 'Cake\Database\Driver\Mysql',
            'persistent' => false,
            'host' => 'XXX-IP',
            //'port' => 'nonstandard_port_number',
            'username' => 'XXXDB',    // Your DB username here
            'password' => 'XXXPW',    // Your DB password here
            'database' => 'scdb',                
            'encoding' => 'utf8',
            'timezone' => 'UTC',
            'cacheMetadata' => true,
            'quoteIdentifiers' => false,
            //'init' => ['SET GLOBAL innodb_stats_on_metadata = 0'],
        ]

The link its trying to process is: https://www.example.com/sub/sub2/debug_kit/webroot/css/reset.css

cake lies in the sub2 folder

htaccess from webroot

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /sub/webroot
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>

htaccess from sub2

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

Upvotes: 0

Views: 280

Answers (2)

Isengo
Isengo

Reputation: 2073

Okay I got it right now, stupid mistake - but I still wonder why it works on my other system :/

    RewriteBase /sub/sub2
    RewriteRule    ^$    webroot/ [L]
    RewriteRule    (.*) webroot/$1 [L]

Before I had a slash infront of the webroot/

Thanks @AD7six for support. I appreciate it.

Upvotes: 1

AD7six
AD7six

Reputation: 66258

CakePHP 3.x does not automatically serve plugin assets unless the asset filter is enabled. The simplest solution is to symlink the plugin files to the webroot:

bin/cake plugin assets symlink

Which is generally recommended for any plugin assets.

It should be noted that you should never have debug kit accessible on a production install as it is a rather obvious security concern.

Upvotes: 0

Related Questions