Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CakePHP 3 is NOT able to connect to the database due to a missing PHP extension

Tags:

mysql

cakephp

I am trying to install cakePHP 3.0.0 with WT-NMP, but i got this message:

CakePHP is NOT able to connect to the database.

Database driver Cake\Database\Driver\Mysql cannot be used due to a missing PHP extension or unmet dependency

my php.ini has this:

extension = php_bz2.dll
extension = php_curl.dll
extension = php_gd2.dll
extension = php_imap.dll
extension = php_mbstring.dll
extension = php_exif.dll
extension = php_mysql.dll
extension = php_mysqli.dll
extension = php_pdo_mysql.dll
extension = php_pdo.dll
extension = php_soap.dll
extension = php_sockets.dll
extension = php_sqlite3.dll
extension = php_openssl.dll
extension = php_fileinfo.dll
extension = php_intl.dll

the app.php has this

    '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' => '3306',
        'username' => 'root',
        'password' => '',
        'database' => 'test',
        'encoding' => 'utf8',
        'timezone' => 'UTC',
        'cacheMetadata' => true,

What am I missing? or this is cakePHP 3.0 bug? OR anything to do with WT-NMP. I have been stuck for whole day.

like image 374
Le Duy Khanh Avatar asked Apr 02 '15 01:04

Le Duy Khanh


3 Answers

Try this:

For PHP 7.0

sudo apt-get install php7.0-mysql

For PHP 5:

sudo apt-get install php5-mysql
like image 186
Amit Dangwal Avatar answered Oct 14 '22 00:10

Amit Dangwal


Solved this by luck!:

extension = php_intl.dll
extension = php_pdo_mysql.dll
intl.default_locale = en_utf8
intl.error_level = E_WARNING
like image 14
Le Duy Khanh Avatar answered Nov 01 '22 20:11

Le Duy Khanh


Installing the modules for MySQL database connections solved it for me:

#Install the package
sudo apt-get install php5-mysql
#Restart Apache
sudo service apache2 restart

Source: http://guru4cakephp.blogspot.nl/2015/04/install-cakephp-3-on-ubuntu.html

Package details: https://packages.debian.org/sid/php5-mysql

like image 13
Ash Avatar answered Nov 01 '22 20:11

Ash