Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CakePHP 2.0.0-RC2 Console baking error

I originally thought this error had to do with my path setup - I had separated the core from the app so I could work more easily with git submodules, so I ignored it. I just did a fresh checkout from the git repo / a download of the RC2 source / and a cakeinit install of the 2.0 package (also uses git) and all 3 installs have the same issue I had before.

My code seems to work fine via the browser.

The output of a ./cake bake Model from inside the local copy of the core in the lib/Cake/Console folder is here https://gist.github.com/1233884

This totally prevents me from using bake. Baking a project doesn't work, baking a new database config doesn't work - it also doesn't matter which of the datasources I try.

Can someone point me in the right direction here? I want to use some of the bake tools and work on converting some shells for 2.0.

I am using XAMPP (latest version for OS X - I reinstalled it 20 minutes ago as a last ditch attempt) OSX 10.5.8

The database.php I am working with is here with the passwords removed but otherwise working https://gist.github.com/1233891

I have tested it with and without the unix_socket setting and encoding settings. All works fine from the browser but again not via the cli.

like image 780
Abba Bryant Avatar asked Sep 22 '11 02:09

Abba Bryant


2 Answers

Okay, the error message could have been be a little bit more specific:

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

DboSource::__construct() is throwing that error here because Mysql::enabled() returns false:

public function enabled() {
    return in_array('mysql', PDO::getAvailableDrivers());
}

On Windows, I can reproduce your error by commenting out the following line from my PHP CLI's php.ini file (the one that running php --ini on the command-line returns):

extension=php_pdo_mysql_libmysql.dll

HTH.

like image 183
deizel Avatar answered Oct 14 '22 01:10

deizel


I was MAMP on Mac and had the same problem with CakePHP 2.2. I solved the problem by installing the mysql pdo for my mac ports installation. sudo port install php5-mysql

like image 1
Steve Tauber Avatar answered Oct 14 '22 02:10

Steve Tauber