【问题标题】:Renaming `database.php.default` to `database.php`in `\app\Config\` in CAKEPHP gives Error在 CAKEPHP 中的 `\app\Config\` 中将 `database.php.default` 重命名为 `database.php` 会出现错误
【发布时间】:2012-06-04 07:17:01
【问题描述】:

在 CAKEPHP 中将 database.php.default 重命名为 database.phpin \app\Config\ 会出错

我在 Windows 7 上的 XAMPP 上安装了 CAKEPHP 2.1.3 的新副本,但出现错误

Warning (2): include_once(D:\xampp\htdocs\cakephp\example\app\Config\database.php) [function.include-once]: failed to open stream: No such file or directory [CORE\Cake\Model\ConnectionManager.php, line 68]


Warning (2): include_once() [function.include]: Failed opening 'D:\xampp\htdocs\cakephp\example\app\Config\database.php' for inclusion (include_path='D:\xampp\htdocs\cakephp\example\lib;.;D:\xampp\php\PEAR') [CORE\Cake\Model\ConnectionManager.php, line 68]

当我查看 \app\config\ 中的 database.php 文件时,它不存在

相反,我在\app\Config\\lib\Cake\Console\Templates\skel\Config 中找到了database.php.default

当我将 database.php.default 重命名为 database.php 时,它仍然给我一个错误。 我需要如何连接到数据库和下一个程序才能继续。

【问题讨论】:

  • 确保你重命名了\app\Config而不是\lib\Cake...

标签: php cakephp database-connection cakephp-2.1


【解决方案1】:

将配置文件从\lib\Cake\Console\Templates\skel\Config 移动到D:\xampp\htdocs\cakephp\example\app\Config\

或者用内容创建一个新的:

class DATABASE_CONFIG {

    public $default = array(
        'datasource' => 'Database/Mysql',
        'persistent' => false,
        'host' => 'localhost',
        'login' => 'username',
        'password' => 'password',
        'database' => 'databas name',
        'prefix' => '',
        //'encoding' => 'utf8',
    );

}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-05-31
    • 2021-01-14
    • 2019-11-10
    • 1970-01-01
    • 2011-06-08
    • 2013-10-20
    • 1970-01-01
    • 2019-09-07
    相关资源
    最近更新 更多