2017-10-18 146 views
0

我剛安裝了linux mint 18.2上的yii2.0高級版,使用XAMPP for Linux 7.0.23,並且我的php yii migrate/up命令doesn'工作。它顯示:異常'yii db Exception'帶消息'找不到驅動程序'

with message 'could not find driver' 

in /opt/lampp/htdocs/yii/vendor/yiisoft/yii2/db/Connection.php:584 

我GOOGLE了它和我有幾個結果。在那裏,我讀了'使用php -m命令';你會知道你的系統使用了哪個php。但是我不知道運行該命令後預期的輸出是什麼。

with message 'could not find driver' 

in /opt/lampp/htdocs/yii/vendor/yiisoft/yii2/db/Connection.php:584 

Stack trace: 
#0 /opt/lampp/htdocs/yii/vendor/yiisoft/yii2/db/Connection.php(928): yii\db\Connection->open() 
#1 /opt/lampp/htdocs/yii/vendor/yiisoft/yii2/db/Connection.php(915): yii\db\Connection->getMasterPdo() 
#2 /opt/lampp/htdocs/yii/vendor/yiisoft/yii2/db/Command.php(219): yii\db\Connection->getSlavePdo() 
#3 /opt/lampp/htdocs/yii/vendor/yiisoft/yii2/db/Command.php(910): yii\db\Command->prepare(true) 
#4 /opt/lampp/htdocs/yii/vendor/yiisoft/yii2/db/Command.php(362): yii\db\Command->queryInternal('fetchAll', NULL) 
#5 /opt/lampp/htdocs/yii/vendor/yiisoft/yii2/db/mysql/Schema.php(199): yii\db\Command->queryAll() 
#6 /opt/lampp/htdocs/yii/vendor/yiisoft/yii2/db/mysql/Schema.php(98): yii\db\mysql\Schema->findColumns(Object(yii\db\TableSchema)) 
#7 /opt/lampp/htdocs/yii/vendor/yiisoft/yii2/db/Schema.php(152): yii\db\mysql\Schema->loadTableSchema('migration') 
#8 /opt/lampp/htdocs/yii/vendor/yiisoft/yii2/console/controllers/MigrateController.php(194): yii\db\Schema->getTableSchema('{{%migration}}', true) 
#9 /opt/lampp/htdocs/yii/vendor/yiisoft/yii2/console/controllers/BaseMigrateController.php(814): yii\console\controllers\MigrateController->getMigrationHistory(NULL) 
#10 /opt/lampp/htdocs/yii/vendor/yiisoft/yii2/console/controllers/BaseMigrateController.php(155): yii\console\controllers\BaseMigrateController->getNewMigrations() 
#11 [internal function]: yii\console\controllers\BaseMigrateController->actionUp(0) 
#12 /opt/lampp/htdocs/yii/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array) 
#13 /opt/lampp/htdocs/yii/vendor/yiisoft/yii2/base/Controller.php(156): yii\base\InlineAction->runWithParams(Array) 
#14 /opt/lampp/htdocs/yii/vendor/yiisoft/yii2/console/Controller.php(128): yii\base\Controller->runAction('up', Array) 
#15 /opt/lampp/htdocs/yii/vendor/yiisoft/yii2/base/Module.php(523): yii\console\Controller->runAction('up', Array) 
#16 /opt/lampp/htdocs/yii/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('migrate/up', Array) 
#17 /opt/lampp/htdocs/yii/vendor/yiisoft/yii2/console/Application.php(147): yii\console\Application->runAction('migrate/up', Array) 
#18 /opt/lampp/htdocs/yii/vendor/yiisoft/yii2/base/Application.php(380): yii\console\Application->handleRequest(Object(yii\console\Request)) 
#19 /opt/lampp/htdocs/yii/yii(27): yii\base\Application->run() 
#20 {main} 

回答

1

您需要安裝pdo_mysql模塊。

sudo apt-get install php-mysql 

之後檢查phpinfo();

+0

先生,我在Yii2.0是新的推進。我很抱歉問這個愚蠢的問題如何檢查phpinfo()的意思是從哪裏檢查和什麼? – Savy

+1

非常感謝你的先生!它的工作原理:) – Savy

+0

歡迎您! :) –

相關問題