Laravel: 錯誤 [PDOException]: 在 PostgreSQL 中找不到驅動程式
<p>Translate: "我正在嘗試透過Laravel連接到PostgreSQL資料庫,以便執行php artisan migrate命令,但似乎沒有成功,因為它正在讀取MySQL的資料庫名稱。<br /><br /> ;以下是database.php中的指令:</p><p><br /></p>
<pre class="brush:php;toolbar:false;">'connections' => array(
'sqlite' => array(
'driver' => 'sqlite',
'database' => __DIR__.'/../database/production.sqlite',
'prefix' => '',
),
'mysql' => array(
'driver' => 'mysql',
'host' => 'localhost',
'database' => 'database',
'username' => 'root',
'password' => '',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
),
'pgsql' => array(
'driver' => 'pgsql',
'host' => 'localhost',
'database' => 'postgres',
'username' => 'postgres',
'password' => 'root',
'charset' => 'utf8',
'prefix' => '',
'schema' => 'public',
),
'sqlsrv' => array(
'driver' => 'sqlsrv',
'host' => 'localhost',
'database' => 'database',
'username' => 'root',
'password' => '',
'prefix' => '',
),
),</pre>
<p>如果我刪除MySQL的路徑,我會得到:</p>
<pre class="brush:php;toolbar:false;">[InvalidArgumentException]
Database [mysql] not configured.</pre>
<p><br /></p><hr />
<strong>Translate: "編輯:當嘗試執行php artisan migrate 命令時,我遇到了'PDOException: could not find driver' 錯誤。我正在使用WAMP 並且在Windows 8.1 上。資料庫使用的是PostgreSQL。"< /strong><p><br /></p>
<p><br /></p><hr />
<strong>EDIT:</strong> Translate: "我已經嘗試了一系列的替代解決方案,但問題仍未解決。已經檢查了Apache、WAMP(來自php 資料夾)和PostgreSQL 中的php.ini檔案。extension_dir 設定正確,如下圖 -> extension_dir = "c:/wamp/bin/php/php5.5.12/ext/"。extension=pdo_pgsql.dll 與extension=pgsql.dll 已取消註解。< br /><br />已經在'系統變數' 中進行了PATH 的設置,並重新啟動了電腦。但仍然沒有成功。<br /><br />感謝迄今為止的幫助。 <br /><br />這是我的驅動程式php_pdo_driver.h 和php_pdo.h 位於C:Program Files (x86)PostgreSQLEnterpriseDB-ApachePHPphpSDKincludeextpdo<br />取得的資訊:<br /><p><br /></p>
<blockquote>
<p>Translate: "PHP 版本5.5.12<br /><br />編譯器MSVC11 (Visual C 2012) 設定指令cscript /nologo configure.js "--enable-snapshot-build" "- -disable-isapi" "--enable-debug-pack" "--without-mssql" "--without-pdo-mssql" "--without-pi3web" "--with-pdo-oci=C:php- sdkoraclex64instantclient10sdk,shared" "--with-oci8=C:php-sdkoraclex64instantclient10sdk,shared" "--with-oci8-11g=C:php-sdkoraclex64instantclient11k,shared" "--object-sdkoraclex642ntclient11k,shared" "--object-outout-dirject obj/" "--enable-com-dotnet=shared" "--with-mcrypt=static" "--disable-static-analyze" "--with-pgo""</p><p>< ;br /></p>
</blockquote><p><br /></p>