Heim  >  Fragen und Antworten  >  Hauptteil

PDOException „Treiber nicht gefunden“ in PHP

<p>Ich habe Lampp auf meinem Linux-System installiert und lerne Symfony2, während ich versuche, ein Schema mit dem Befehl Symfony2 zu erstellen</p> <pre class="brush:php;toolbar:false;">php app/console doctrine:schema:create</pre> <p>Ich habe die folgende Fehlermeldung erhalten: -</p> <pre class="brush:php;toolbar:false;">PDOException „Treiber konnte nicht gefunden werden“</pre> <p>Ich habe auch die Zeile <code>extension=php_pdo_mysql.dll</code></p> auskommentiert <p>Ich habe versucht, mein Problem zu finden und zu suchen, konnte es aber nicht lösen. Wenn ich den Befehl <code>php -m</code> ausführe, erhalte ich das folgende Ergebnis: -</p> <pre class="brush:php;toolbar:false;">PHP-Warnung: PHP-Start: Dynamische Bibliothek '/usr/lib/php5/20090626+lfs/mysql.so' kann nicht geladen werden – /usr/lib/ php5/20090626+lfs/mysql.so: Gemeinsam genutzte Objektdatei kann nicht geöffnet werden: Keine solche Datei oder kein solches Verzeichnis in „Unbekannt“ in Zeile 0 PHP-Warnung: PHP-Start: Die dynamische Bibliothek „/usr/lib/php5/20090626+lfs/mysqli.so“ kann nicht geladen werden – /usr/lib/php5/20090626+lfs/mysqli.so: Shared-Object-Datei kann nicht geöffnet werden: Nein Eine solche Datei oder ein solches Verzeichnis in „Unbekannt“ in Zeile 0 PHP-Warnung: PHP-Startup: Dynamische Bibliothek '/usr/lib/php5/20090626+lfs/pdo_mysql.so' kann nicht geladen werden - /usr/lib/php5/20090626+lfs/pdo_mysql.so: Shared-Object-Datei kann nicht geöffnet werden: Nein Eine solche Datei oder ein solches Verzeichnis in „Unbekannt“ in Zeile 0 [PHP-Module] bcmath bz2 Kalender Kern ctype Datum dba dom ereg exif Dateiinformation Filter ftp gettext Hash iconv json libxml mbstring mhash openSL pcntl pcre gU ---- ----</pre> <p>Gibt es eine Möglichkeit, dieses Problem zu beheben? </p>
P粉478445671P粉478445671418 Tage vor565

Antworte allen(2)Ich werde antworten

  • P粉788571316

    P粉7885713162023-08-30 11:07:20

    在Ubuntu中,在控制台中写入

    sudo apt-get install php5-gd php5-mysql

    它会起作用

    Antwort
    0
  • P粉203792468

    P粉2037924682023-08-30 09:52:16

    希望您正在本地主机中运行您的项目。在你的项目文件夹 app/config 中有一个名为parameters.ini的文件,确保你的Mysql数据库连接配置正确。如果您使用 mysql,请参阅database_driver=pdo_mysql 是它的驱动程序。

    下面是一个示例。

    database_driver   = pdo_mysql
        database_host     = localhost
        database_port     =
        database_name     = databasename
        database_user     = msqlusername
        database_password = mysqlpassword//if not make blank
    
        mailer_transport  = smtp
        mailer_host       = localhost
        mailer_user       =
        mailer_password   =
    
        locale            = en
    
        secret            = ThisTokenIsNotSoSecretChangeIt

    希望对您有帮助。

    Antwort
    0
  • StornierenAntwort