2
votes

I'm developing CakePHP based application, on WAMP.

For some reason I cannot run cake bake anymore.

After I run command:

c:\Program Files\wamp\www\my-application>"c:\Program Files\wamp\www\cakephp-246 0\app\Console\cake.bat" bake

... I'm getting following error:

Welcome to CakePHP v2.4.6 Console
---------------------------------------------------------------
App : my-application
Path: c:\Program Files\wamp\www\my-application\
---------------------------------------------------------------
---------------------------------------------------------------
Bake Model
Path: c:\Program Files\wamp\www\my-application\Model\
---------------------------------------------------------------
Error: Database connection "Mysql" is missing, or could not be created.
#0 C:\Program Files\wamp\www\cakephp-2460\lib\Cake\Model\ConnectionManager.php(1
05): DboSource->__construct(Array)
#1 C:\Program Files\wamp\www\cakephp-2460\lib\Cake\Console\Command\Task\ModelTas
k.php(927): ConnectionManager::getDataSource('default')
#2 C:\Program Files\wamp\www\cakephp-2460\lib\Cake\Console\Command\Task\ModelTas
k.php(864): ModelTask->getAllTables(NULL)
#3 C:\Program Files\wamp\www\cakephp-2460\lib\Cake\Console\Command\Task\ModelTas
k.php(954): ModelTask->listAll(NULL)
#4 C:\Program Files\wamp\www\cakephp-2460\lib\Cake\Console\Command\Task\ModelTas
k.php(203): ModelTask->getName()
#5 C:\Program Files\wamp\www\cakephp-2460\lib\Cake\Console\Command\Task\ModelTas
k.php(91): ModelTask->_interactive()
#6 C:\Program Files\wamp\www\cakephp-2460\lib\Cake\Console\Shell.php(437): Model
Task->execute()
#7 C:\Program Files\wamp\www\cakephp-2460\lib\Cake\Console\Shell.php(434): Shell
->runCommand('execute', Array)
#8 C:\Program Files\wamp\www\cakephp-2460\lib\Cake\Console\ShellDispatcher.php(2
07): Shell->runCommand('model', Array)
#9 C:\Program Files\wamp\www\cakephp-2460\lib\Cake\Console\ShellDispatcher.php(6
6): ShellDispatcher->dispatch()
#10 C:\Program Files\wamp\www\cakephp-2460\app\Console\cake.php(36): ShellDispat
cher::run(Array)
#11 {main}

c:\Program Files\wamp\www\my-application>

It worked before. I think that problem started after PHP was upgraded.

I followed lot's of instructions like:

CakePHP Bake Shell Error: Database connection “Mysql” is missing, or could not be created

CakePHP Database connection "Mysql" is missing, or could not be created

CakePHP bake Error: Database connection "Mysql" is missing, or could not be created

... etc, but did not solved my problem.

I have to mention that my CakePHP application WORKS, and that only problem I have is that I cannot run any of cake bake options.

2
go to c:\Program Files\wamp\www\my-application\app and then run cake bakeFury
But I do not have app directory...user198003
ok. where ever you app is located you need to go to path and app directory (../app). and then run cake bake. e.g. app>cake bakeFury
Run Console/cake -app c:\path\to\your\app\directory bake.bancer
@bancer still the same :-(user198003

2 Answers

1
votes

You probably need to add a path to the mysql socket file

In app/Config/Database.php add the unix_socket parameter

'unix_socket' => '/path/to/sql/socket'

0
votes

This is something I also experienced on my windows server OS and fixed by a simple step given below.

  1. open active php.ini and enable extension=php_openssl.dll by un-commenting that line.

  2. restart the IIS/ web server

It should work now.

An additional step:

  1. backup the content of the TMP folder and then delete files from within the folders from TMP folder.