douzhushen_9776
2016-06-27 09:10
浏览 30
已采纳

CakePHP 3 debug_kit带子目录

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>
  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • doulangbizhan5160 2016-06-29 08:26
    已采纳

    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.

    已采纳该答案
    评论
    解决 无用
    打赏 举报
  • dsjlqkbpn029473708 2016-06-27 09:36

    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.

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题