2017-03-01 64 views
0

在我的heroku中,我使用postgre插件作爲我的數據庫;在我的cakephp 3應用程序中,我更改了文件app.php並配置了與heroku postgre數據庫的連接。我的CakePHP的應用程序都運行良好在本地主機上,但是Heroku的服務器上,頁面顯示在heroku上找不到Cakephp類'DebugBarFilter'

Class'DebugKit\Routing\Filter\DebugBarFilter' not found 
Error in: ROOT/plugins/DebugKit/config/bootstrap.php, line 21 

如果我修改app.php的文件env('DEBUG', true)env('DEBUG', false)顯示內部錯誤服務器頁面。

我想我是否也需要在Heroku中安裝mysql?因爲插件DebugKit默認使用它?或者無論如何,我可以卸載/跳過DebugKit,以便它不會顯示錯誤?因爲我並不需要在我的服務器上安裝DebugKit插件。下面是我的bootstrap.php文件:

<?php 
/** 
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) 
* 
* Licensed under The MIT License 
* For full copyright and license information, please see the LICENSE.txt 
* Redistributions of files must retain the above copyright notice. 
* 
* @copyright  Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) 
* @link   http://cakephp.org CakePHP(tm) Project 
* @license  http://www.opensource.org/licenses/mit-license.php MIT License 
*/ 
use Cake\Core\Configure; 
use Cake\Core\Plugin; 
use Cake\Datasource\ConnectionManager; 
use Cake\Event\EventManager; 
use Cake\Log\Log; 
use Cake\Routing\DispatcherFactory; 
use DebugKit\Routing\Filter\DebugBarFilter; 
$debugBar = new DebugBarFilter(EventManager::instance(), (array)Configure::read('DebugKit')); 
if (!$debugBar->isEnabled() || php_sapi_name() === 'cli' || php_sapi_name() === 'phpdbg') { 
    return; 
} 
$hasDebugKitConfig = ConnectionManager::config('debug_kit'); 
if (!$hasDebugKitConfig && !in_array('sqlite', PDO::getAvailableDrivers())) { 
    $msg = 'DebugKit not enabled. You need to either install pdo_sqlite, ' . 
     'or define the "debug_kit" connection name.'; 
    Log::warning($msg); 
    return; 
} 
if (!$hasDebugKitConfig) { 
    ConnectionManager::config('debug_kit', [ 
     'className' => 'Cake\Database\Connection', 
     'driver' => 'Cake\Database\Driver\Sqlite', 
     'database' => TMP . 'debug_kit.sqlite', 
     'encoding' => 'utf8', 
     'cacheMetadata' => true, 
     'quoteIdentifiers' => false, 
    ]); 
} 
if (Plugin::routes('DebugKit') === false) { 
    require __DIR__ . DS . 'routes.php'; 
} 
// Setup toolbar 
$debugBar->setup(); 
DispatcherFactory::add($debugBar); 

回答

0

找到了解決辦法,註釋掉以下行此文件中

Plugin::load('DebugKit', ['bootstrap' => true]); 
0

你也可以使用

Plugin::loadAll(); 

要加載的所有插件