在我的heroku中,我使用postgre插件作为我的数据库;在我的cakephp 3应用程序中,我更改了文件app.php
并配置了与heroku postgre数据库的连接。我的cakephp应用程序在localhost上运行良好,但在heroku服务器上,显示
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 :(得分:0)
找到解决方案,注释掉此文件config/bootstrap.php
Plugin::load('DebugKit', ['bootstrap' => true]);
答案 1 :(得分:0)
您也可以使用
Plugin::loadAll();
加载所有插件