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

时间:2012-06-04 07:17:01

标签: php cakephp database-connection cakephp-2.1

在CAKEPHP的database.php.default中将database.php重命名为\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]

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

相反,我在database.php.default\app\Config\

中找到了\lib\Cake\Console\Templates\skel\Config

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

1 个答案:

答案 0 :(得分:2)

将配置文件从\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',
    );

}