I’m using a standard MySQL db on my server and trying to connect my install of CakePHP 2.0 to it. I’m using this for my settings:
public $default = array(
'datasource' => 'Database/Mysql',
'persistent' => false,
'unix_socket' => '/tmp/mysql.sock',
'login' => 'mylogin',
'password' => 'mypw',
'database' => 'mydb',
);
But my cakephp page comes up as cannot connect to the database. I’ve set debug to 2, but how do I find out what is the issue with the database connection?
I’ve also tried a normal mysql connect in a .ctp file and it works fine with the login/password I give it…
It could be that you dont not have the PDO_Mysql extension enabled, as thats what CakePHP 2.0 uses.
Try to create a small script outside of CakePHP, to see if this is enabled. And try to connect to the database with:
https://www.php.net/manual/en/pdo.construct.php