0

I just downloaded CakePHP 2.1 and did all the setup for the database and all the rest, but I'm unable to use the cake console, I get the following error:

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

If I open the site on my browser I see this:

enter image description here

This is my database.php:

public $default = array(                                                                                                                                              
  'datasource' => 'Database/Mysql',                                                                                                                                   
  'persistent' => false,                                                                                                                                              
  'host' => '127.0.0.1',                                                                                                                                              
  'login' => 'user',                                                                                                                                                  
  'password' => 'password',                                                                                                                                        
  'database' => 'database_schema',                                                                                                                                    
  'prefix' => '',                                                                                                                                                     
  'encoding' => 'utf8',                                                                                                                                               
  'port' => ' /Applications/xampp/xamppfiles/var/mysql/mysql.sock',                                                                                                   
);

I'm using XAMPP 1.7.3, I read that the issue might be related to PDO, but I have no idea how to set it up properly, any suggestions?

8vius
  • 5,786
  • 14
  • 74
  • 136

2 Answers2

1

You should enable the php_pdo_extension in php.ini. The file is located at /Applications/XAMPP/etc/php.ini by default.

Faruk Sahin
  • 8,406
  • 5
  • 28
  • 34
  • Says it's enabled, I think the problem is that i'm pointing to the default PHP installation and not XAMPP's. – 8vius Oct 17 '12 at 12:07
0

Mine was Mac OS Yosemite ,MAMP PHP 5.6.1 and spent almost two days trying all the fixes available..finally it was something do with php.ini extension_dir

Old value was '.../no-debug-non-zts-20121212' which was not there in the path specified , so i changed the path to available directory as below...and success!!

php.ini located in MAMP - /Applications/MAMP/bin/php/php5.6.1/conf (This can also be found using phpinfo() under 'Configuration File (php.ini) Path')

fixed path in php.ini

; Directory in which the loadable extensions (modules) reside.

extension_dir = "/Applications/MAMP/bin/php/php5.6.1/lib/php/extensions/no-debug-non-zts-20131226/"

tranepura
  • 1
  • 1