11

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.

Your Common Sense
  • 156,878
  • 40
  • 214
  • 345
Le Duy Khanh
  • 1,339
  • 3
  • 17
  • 36

6 Answers6

14

Solved this by luck!:

extension = php_intl.dll
extension = php_pdo_mysql.dll
intl.default_locale = en_utf8
intl.error_level = E_WARNING
Le Duy Khanh
  • 1,339
  • 3
  • 17
  • 36
13

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

Ash
  • 8,583
  • 10
  • 39
  • 52
9

Try this:

For PHP 7.0

sudo apt-get install php7.0-mysql

For PHP 5:

sudo apt-get install php5-mysql
Undo
  • 25,519
  • 37
  • 106
  • 129
Amit Dangwal
  • 421
  • 1
  • 4
  • 10
5

The error message is because of extension = php_pdo_mysql.dll not being installed and enabled in php.ini. If you don't have php_intl.dll enabled you will get an error before checking the database connection.

Your php.ini indicates that you have got php_pdo_mysql.dll enabled, however it may have been that you needed to restart the CakePHP server bin/cake server.

icc97
  • 11,395
  • 8
  • 76
  • 90
1

Don't just depend on the php.ini reading. Just check if you have installed php[v]-mysql extension. You can check if php_mysql.dll exist in the php extension directory(most probably <path to your php installation>/ext) in your windows based server. In linux you can use the following command check if it is installed.

yum list installed | grep php

It will list down all the php extensions installed.

Johna
  • 1,836
  • 2
  • 18
  • 29
0

For Windows:

extension=pdo_sqlite
extension=sqlite3
user16217248
  • 3,119
  • 19
  • 19
  • 37
  • Please add some kind of explanation addressing the thing you used in your answer or documentation mentioning the same. – Archit Gargi Apr 04 '23 at 07:31