php - Cake 无法连接到数据库

标签 php cakephp

我正在使用 Wamp 服务器,我正在尝试安装 CakePHP 2.0.0,但遇到了问题。

我将 CakePHP 2.0.0 文件放在我的 wamp 服务器文件夹“www”和“cake”文件夹中。

当我在浏览器中输入地址 http://localhost/cake 时,会显示以下消息:

CakePHP: the rapid development php framework
Release Notes for CakePHP 2.0.0-dev.

Notice (1024): Please change the value of 'Security.salt' in app/config/core.php to a salt value specific to your application [CORE\Cake\Utility\Debugger.php, line 647]

Notice (1024): Please change the value of 'Security.cipherSeed' in app/config/core.php to a numeric (digits only) seed value specific to your application [CORE\Cake\Utility\Debugger.php, line 651]

Your tmp directory is writable.

The FileEngine is being used for caching. To change the config edit APP/config/core.php

Your database configuration file is present.

Cake is NOT able to connect to the database.
Editing this Page

To change the content of this page, create: APP/views/pages/home.ctp.
To change its layout, create: APP/views/layouts/default.ctp.
You can also add some CSS styles for your pages at: APP/webroot/css.

最佳答案

我遇到了同样的问题,需要大量研究才能确定实际问题。

新版本的 CakePHP 使用 pdo 来建立连接,而不是像以前那样使用 mysql 或 mysqli。由于您使用的是 Windows 环境,只需在 php.ini 文件中启用以下内容即可。

extension=php_pdo_mysql.dll

与使用 root 无关,我还发现在尝试从 1.3 迁移到 2.0 时这真的很烦人

至于 deceze 的傲慢回答,我发现在 CakePHP 下载/安装/文档的任何地方都没有提及此更改。

关于php - Cake 无法连接到数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6212290/

相关文章:

php - Zend 邮件 Gmail SMTP

Cakephp - HABTM 记录不会删除唯一设置为 true 的情况

php - CakePHP 3 关联删除

php - 如何使用 InsertInto 将清理后的用户输入存储在数据库中

php - 使用android volley post请求从MySQL中选择数据并将其显示在recyclerview中

php - .htaccess 如果文件不存在则重定向

cakephp - Cake php 模型关系的难度,尤其是。有很多通过

php - 重定向到主页(索引)

php - Cakephp 覆盖 HtmlHelper::link

cakephp - 调试在 get 中发送的 CakePHP HttpSocket 数据