質問

Attempting to Cake Bake throws 'php_pdo_mysql.dll' problems:

root@ankan-ad:/opt/lampp/htdocs/resource/newbaker/app# Console/cake bake all
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20121212/php_pdo_mysql.dll' - /usr/lib/php5/20121212/php_pdo_mysql.dll: 
cannot open shared object file: No such file or directory in Unknown on line 0

Following this:

Welcome to CakePHP v2.4.6 Console
---------------------------------------------------------------
App : app
Path: /opt/lampp/htdocs/resource/newbaker/app/
---------------------------------------------------------------
Bake All
---------------------------------------------------------------
Error: Database connection "Mysql" is missing, or could not be created.
#0 /opt/lampp/htdocs/resource/newbaker/lib/Cake/Model/ConnectionManager.php(105): DboSource->__construct(Array)
#1 /opt/lampp/htdocs/resource/newbaker/lib/Cake/Console/Command/Task/ModelTask.php(927): ConnectionManager::getDataSource('default')
#2 /opt/lampp/htdocs/resource/newbaker/lib/Cake/Console/Command/Task/ModelTask.php(864): ModelTask->getAllTables('default')
#3 /opt/lampp/htdocs/resource/newbaker/lib/Cake/Console/Command/Task/ModelTask.php(954): ModelTask->listAll('default')
#4 /opt/lampp/htdocs/resource/newbaker/lib/Cake/Console/Command/BakeShell.php(150): ModelTask->getName('default')
#5 /opt/lampp/htdocs/resource/newbaker/lib/Cake/Console/Shell.php(437): BakeShell->all()
#6 /opt/lampp/htdocs/resource/newbaker/lib/Cake/Console/ShellDispatcher.php(207): Shell->runCommand('all', Array)
#7 /opt/lampp/htdocs/resource/newbaker/lib/Cake/Console/ShellDispatcher.php(66): ShellDispatcher->dispatch()
#8 /opt/lampp/htdocs/resource/newbaker/app/Console/cake.php(36): ShellDispatcher::run(Array)
#9 {main}

Solutions tried:

  1. The cakephp home page, shows green being able to connect to MySql.
  2. adding 'unix_socket' => '/opt/lampp/var/mysql/mysql.sock'to my database.php default array does not help
  3. I checked my php.ini:

Am I doing something wrong in the php.ini files?

The following are all the uncommented lines in php.ini that have 'extension='
Output of grep -Hrvn ";" /etc/php5 | grep -i "extension="

/etc/php5/cli/php.ini:4:extension=php_pdo_mysql.dll
/etc/php5/mods-available/opcache.ini:3:zend_extension=opcache.so
/etc/php5/mods-available/pdo.ini:3:extension=pdo.so
/etc/php5/mods-available/readline.ini:3:extension=readline.so
/etc/php5/mods-available/json.ini:3:extension=json.so
/etc/php5/apache2/php.ini:4:extension=php_pdo_mysql.dll
役に立ちましたか?

解決

It looks like there are two problems:

  • You are trying to load DLLs in, probably having copied those extension lines from a Windows php.ini. Linux does not use DLLs, and furthermore PHP on Ubuntu generally has no extensions specified in the main ini file at all. Instead you just load the extensions you need from the standard software repository
  • You don't currently have MySQL support. Run sudo apt-get install php5-mysql to get this loaded and installed

As an extra thought, if you want to see what's available for PHP, try apt-cache search php5- - that will let you see all the things you can load.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top