CakePHP 3 cannot connect to database due to lack of PHP extension

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

CakePHP CANNOT connect to the database.

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

my php.ini has the following:

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 

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 is it cakePHP 3.0 error? OR anything related to WT-NMP. I was stuck all day.

+6
source share
5 answers

I decided it luck !:

 extension = php_intl.dll extension = php_pdo_mysql.dll intl.default_locale = en_utf8 intl.error_level = E_WARNING 
+8
source

Installing modules to connect to the MySQL database allowed 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

+8
source

The error message is because extension = php_pdo_mysql.dll not installed and is not included in php.ini . If you do not have php_intl.dll enabled, you will receive an error message before checking the database connection.

Your php.ini indicates that you have enabled php_pdo_mysql.dll , however, you might need to restart the CakePHP bin/cake server .

+3
source

Not just depend on reading php.ini. Just check if the php [v] -mysql extension is installed. You can check if php_mysql.dll exists in the php extension directory (most likely <path to your php installation>/ext ) on your Windows based server. On linux, you can use the following command if it is installed.

 yum list installed | grep php 

It will display a list of all php extensions.

+1
source

Try the following:

For PHP 7.0

 sudo apt-get install php7.0-mysql 

For PHP 5:

 sudo apt-get install php5-mysql 
0
source

Source: https://habr.com/ru/post/984592/


All Articles