CakePHP is NOT able to connect to the database.

当时我学习cakephp,想尝试连接本地mysql数据库,突然有报错问题是无法连接mysql,想想自己怎么去解决问题,希望能成功连接mysql就更好了。

app.php文件:

'default' => [
            'className' => 'Cake\Database\Connection',
            'driver' => 'Cake\Database\Driver\Mysql',
            'persistent' => false,
            'host' => 'localhost',
            /**
             * CakePHP will use the default DB port based on the driver selected
             * MySQL on MAMP uses port 8889, MAMP users will want to uncomment
             * the following line and set the port accordingly
             */
            //'port' => 'non_standard_port_number',
            'username' => 'my_app',
            'password' => 'secret',
            'database' => 'my_app',
            'encoding' => 'utf8',
            'timezone' => 'UTC',
            'flags' => [],
            'cacheMetadata' => true,

这个正常状态的,不过我在想可能是php.ini文件配置没加关于mysql的拓展吧。

我想尽快解决这个问题吧!

参考地址:http://stackoverflow.com/questions/29403450/cakephp-3-is-not-able-to-connect-to-the-database-due-to-a-missing-php-extension