Cake \ Database \ Driver \ Mysql database driver can not be used due to missing PHP extension

3

I'm having problems with CakePHP bake, I searched for solutions in several places but none solved the problem.

Error log:

Exception: Database driver Cake\Database\Driver\Mysql cannot be used due to a missing PHP extension or unmet dependency in [/opt/lampp/htdocs/bookmarker/vendor/cakephp/cakephp/src/Database/Connection.php, line 171]
    2015-09-10 01:03:44 Error: [Cake\Database\Exception\MissingExtensionException] Database driver Cake\Database\Driver\Mysql cannot be used due to a missing PHP extension or unmet dependency
    Exception Attributes: array (
      'driver' => 'Cake\Database\Driver\Mysql',
    )
    Stack Trace:
    #0 /opt/lampp/htdocs/bookmarker/vendor/cakephp/cakephp/src/Database/Connection.php(107): Cake\Database\Connection->driver('Cake\Database\D...', Array)
    #1 /opt/lampp/htdocs/bookmarker/vendor/cakephp/cakephp/src/Datasource/ConnectionRegistry.php(76): Cake\Database\Connection->__construct(Array)
    #2 /opt/lampp/htdocs/bookmarker/vendor/cakephp/cakephp/src/Core/ObjectRegistry.php(93): Cake\Datasource\ConnectionRegistry->_create('Cake\Database\C...', 'default', Array)
    #3 /opt/lampp/htdocs/bookmarker/vendor/cakephp/cakephp/src/Datasource/ConnectionManager.php(196): Cake\Core\ObjectRegistry->load('default', Array)
    #4 /opt/lampp/htdocs/bookmarker/vendor/cakephp/bake/src/Shell/Task/ModelTask.php(167): Cake\Datasource\ConnectionManager::get('default')
    #5 /opt/lampp/htdocs/bookmarker/vendor/cakephp/bake/src/Shell/Task/ModelTask.php(108): Bake\Shell\Task\ModelTask->getTableObject('Users', 'users')
    #6 /opt/lampp/htdocs/bookmarker/vendor/cakephp/bake/src/Shell/Task/ModelTask.php(96): Bake\Shell\Task\ModelTask->bake('Users')
    #7 /opt/lampp/htdocs/bookmarker/vendor/cakephp/bake/src/Shell/BakeShell.php(250): Bake\Shell\Task\ModelTask->main('Users')
    #8 /opt/lampp/htdocs/bookmarker/vendor/cakephp/cakephp/src/Collection/CollectionTrait.php(52): Bake\Shell\BakeShell->Bake\Shell\{closure}('users', 0)
    #9 /opt/lampp/htdocs/bookmarker/vendor/cakephp/bake/src/Shell/BakeShell.php(253): Cake\Collection\Collection->each(Object(Closure))
    #10 [internal function]: Bake\Shell\BakeShell->all('users')
    #11 /opt/lampp/htdocs/bookmarker/vendor/cakephp/cakephp/src/Console/Shell.php(380): call_user_func_array(Array, Array)
    #12 /opt/lampp/htdocs/bookmarker/vendor/cakephp/cakephp/src/Console/ShellDispatcher.php(204): Cake\Console\Shell->runCommand(Array, true)
    #13 /opt/lampp/htdocs/bookmarker/vendor/cakephp/cakephp/src/Console/ShellDispatcher.php(175): Cake\Console\ShellDispatcher->_dispatch()
    #14 /opt/lampp/htdocs/bookmarker/vendor/cakephp/cakephp/src/Console/ShellDispatcher.php(126): Cake\Console\ShellDispatcher->dispatch()
    #15 /opt/lampp/htdocs/bookmarker/bin/cake.php(33): Cake\Console\ShellDispatcher::run(Array)
    #16 {main}
    
asked by anonymous 10.09.2015 / 03:11

1 answer

1

This error message occurs because the php_pdo_mysql.dll extension is not installed and / or enabled on your php.ini .

After doing this you must restart the server you are using (apache or bake server ).

Original response was taken from SOEN:

link

    
15.12.2015 / 16:06