尝试Cake Bake投掷' php_pdo_mysql.dll'问题:
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
接下来:
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}
尝试解决方案:
'unix_socket' => '/opt/lampp/var/mysql/mysql.sock'
添加到我的database.php默认数组无效我在php.ini文件中做错了吗?
以下是php.ini中所有未注释的行,其中包含' extension ='
输出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
答案 0 :(得分:3)
看起来有两个问题:
extension
行。 Linux不使用DLL,而且Ubuntu上的PHP通常根本没有在主ini文件中指定的扩展名。相反,您只需从标准软件存储库sudo apt-get install php5-mysql
以加载并安装另外一个想法是,如果你想看看PHP的可用内容,试试apt-cache search php5-
- 这将让你看到你可以加载的所有内容。