2017-07-27 121 views
0
「找不到驅動程序」

嘿大家正在嘗試部署我的symfony 3應用程序我上載設置我的VPS 1 & 1主辦ubuntu 16.04項目文件我安裝php , mysql , apache2後。Symfony3部署問題PDOException在PHP

我試圖運行命令 php bin/console doctrine:schema:create

錯誤:

[Doctrine\DBAL\Exception\DriverException] 
An exception occured in driver: could not find driver 

[Doctrine\DBAL\Driver\PDOException] 
could not find driver 

[PDOException] 
could not find driver 

首先,我雖然它也許參數的問題,但後來我改變了我的文件parameters.yml像下面這段代碼的一些變化:

This file is auto-generated during the composer install 
parameters: 
    database_host: 127.0.0.1 
    database_port: 3306 
    database_name: kuenstlerdienste 
    database_user: Test 
    database_password: xxxxx 
    mailer_transport: smtp 
    mailer_host: 127.0.0.1 
    mailer_user: null 
    mailer_password: null 
    secret: 40ea1d1efb058912e7ae152d2847c9834d97faa4 
    authentication.handler.login_success_handler.class: KuenstlerdiensteBundle\Security\LoginSuccessHandler 

我不認爲這是錯字原因憑據是有效的,當我輸入mysql 登錄後我得到這個結果

mysql> Show DATABASES 
-> ; 
+--------------------+ 
| Database   | 
+--------------------+ 
| information_schema | 
| kuenstlerdienste | 
+--------------------+ 
2 rows in set (0.00 sec) 

如果我的車輛定位系統安裝PDO我也測試:通過鍵入php -m,它是在結果中提到PDO

我不明白這一點,如果它是symofony問題或在mysql配置文件中有缺少的東西,多虧了任何幫助

+1

您確保已安裝PDO的Mysql? PDO不一定意味着安裝了mysql驅動程序。 – PressingOnAlways

+1

嘗試激活'mysqlnd'驅動程序。在php.ini中搜索並取消註釋。請參閱:[MySQL本地驅動程序](http://php.net/manual/en/intro.mysqlnd.php) - 簡介和概述。 – 2017-07-27 20:23:55

+1

您是否看到:'PDO'和'pdo_mysql'?否則,如果你在Debian上,試試:'apt-get install php-mysql'。你不僅需要PDO,而且如果你只是安裝'php',你只需要沒有pdo_mysql的PDO。 – mpiot

回答

2

試着用這個來檢查你是否安裝了模塊。

php -m | grep pdo 

預期的是這樣的:

pdo_mysql