cakePHP和EasyPHP无法烘烤

时间:2014-11-17 16:44:40

标签: php mysql cakephp

我正在尝试使用cakephp的“cake bake”命令, 但每当我试着打电话给那个命令时,我得到:

What would you like to Bake? (D/M/V/C/P/F/T/Q)
> m
---------------------------------------------------------------
Bake Model
Path: C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\test\app\Model\
---------------------------------------------------------------
Error: Database connection "Mysql" is missing, or could not be created.
#0 C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\test\lib\Cake\Model\ConnectionManager.php(105): DboSource->__construct(Array)
#1 C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\test\lib\Cake\Console\Command\Task\ModelTask.php(948): ConnectionManager::getDataSource('defa
ult')
#2 C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\test\lib\Cake\Console\Command\Task\ModelTask.php(885): ModelTask->getAllTables(NULL)
#3 C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\test\lib\Cake\Console\Command\Task\ModelTask.php(975): ModelTask->listAll(NULL)
#4 C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\test\lib\Cake\Console\Command\Task\ModelTask.php(203): ModelTask->getName()
#5 C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\test\lib\Cake\Console\Command\Task\ModelTask.php(91): ModelTask->_interactive()
#6 C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\test\lib\Cake\Console\Command\BakeShell.php(109): ModelTask->execute()
#7 C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\test\lib\Cake\Console\Shell.php(440): BakeShell->main()
#8 C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\test\lib\Cake\Console\ShellDispatcher.php(209): Shell->runCommand(NULL, Array)
#9 C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\test\lib\Cake\Console\ShellDispatcher.php(66): ShellDispatcher->dispatch()
#10 C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\test\app\Console\cake.php(47): ShellDispatcher::run(Array)
#11 {main}

我已经阅读并尝试了我在google和stackoverflow上找到的所有解决方案,但它们都没有工作, 当我实现自己的模型,控制器和视图时,连接正常。

1 个答案:

答案 0 :(得分:0)

它说缺少与Mysql的连接。

确保首先在服务器中安装了MySQL。

然后,您在/app/Config/database.php中更改了数据库配置吗?您需要先设置数据库。

如果您已经这样做了,请测试连接吗?运行localhost / yourwebfolder将显示,如果您已经正确设置CakePHP,然后才能继续"烘焙"