Mhofhands
Mhofhands

Reputation: 13

Cakephp CLI error

I am using cakephp 2.x and im trying Code Generation with Bake. When i try to cake bake all. Below are the errors i am getting in command line.

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\victorm>cd c:\wamp\www\myappname\app\Console

c:\wamp\www\myappname\app\Console>cake bake all


Welcome to CakePHP v2.4.2 Console

App : Console
Path: c:\wamp\www\myappname\app\Console\


Bake All


Warning Error: include_once(c:\wamp\www\myappname\app\Console\Config\database.php): failed to open stream: No such file or directory in [C:\wamp\www\myappname\lib\Cake\Model\ConnectionManager.php, line 69]

Warning Error: include_once(): Failed opening 'c:\wamp\www\myappname\app\Console\Config\database.php' for inclusion (include_path='C:\wamp\www\myappname\lib;.;C:\php5\pear') in [C:\wamp\www\myappname\lib\Cake\Model\ConnectionManager.php, line 69]

Error: The datasource configuration "default" was not found in database.php
#0 C:\wamp\www\myappname\lib\Cake\Model\ConnectionManager.php(93): Connection
Manager::_getConnectionObject('default')
#1 C:\wamp\www\myappname\lib\Cake\Console\Command\Task\ModelTask.php(929): ConnectionManager::getDataSource('default')
#2 C:\wamp\www\myappname\lib\Cake\Console\Command\Task\ModelTask.php(866): ModelTask->getAllTables('default')
#3 C:\wamp\www\myappname\lib\Cake\Console\Command\Task\ModelTask.php(955): ModelTask->listAll('default')
#4 C:\wamp\www\myappname\lib\Cake\Console\Command\BakeShell.php(152): ModelTask->getName('default')
#5 C:\wamp\www\myappname\lib\Cake\Console\Shell.php(433): BakeShell->all()
#6 C:\wamp\www\myappname\lib\Cake\Console\ShellDispatcher.php(209): Shell->runCommand('all', Array)
#7 C:\wamp\www\myappname\lib\Cake\Console\ShellDispatcher.php(68): ShellDispatcher->dispatch()
#8 C:\wamp\www\myappname\app\Console\cake.php(37): ShellDispatcher::run(Array)
#9 {main}


c:\wamp\www\myappname\app\Console>

Does anyone have an idea on how to fix this?

Upvotes: 0

Views: 1224

Answers (1)

mark
mark

Reputation: 21743

You are in the wrong folder. Always navigate to your APP dir and call the cake console relativly from there

cd c:\wamp\www\myappname\app\
.\Console\cake [command]

Alternativly, if you really want to call the core one:

..\lib\Cake\Console\cake [command]

Note that the above use the windows specific calls. For linux it is

Console/cake // or
../lib/Cake/Console/cake

Upvotes: 1

Related Questions