我正在尝试通过Laravel连接PostgreSQL数据库以执行php artisan migrate,但似乎没有成功,因为它正在读取MySQL的数据库名称。
这是来自database.php的命令:
'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' => '',
),
),
如果我删除MySQL路径,将会得到:[InvalidArgumentException]
Database [mysql] not configured.
当尝试运行'php artisan migrate'时,我遇到了'PDOException: could not find driver'的问题。我正在使用WAMP并且在Win8.1上。使用PostgreSQL作为数据库。已经尝试了一系列的替代方案,但我仍然需要解决这个问题。在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都被取消注释。
在“系统变量”中进行了路径设置的修改并重新启动电脑,但没有改善。
感谢到目前为止提供的帮助。
这是我的驱动程序php_pdo_driver.h和php_pdo.h,位于C:\Program Files (x86)\PostgreSQL\EnterpriseDB-ApachePHP\php\SDK\include\ext\pdo目录下。
来自phpinfo的信息:
PHP版本5.5.12
编译器MSVC11(Visual C++ 2012)
Configure Command cscript /nologo configure.js "--enable-snapshot-build" "--disable-isapi" "--enable-debug-pack" "--without-mssql" "--without-pdo-mssql" "--without-pi3web" "--with-pdo-oci=C:\php-sdk\oracle\x64\instantclient10\sdk,shared" "--with-oci8=C:\php-sdk\oracle\x64\instantclient10\sdk,shared" "--with-oci8-11g=C:\php-sdk\oracle\x64\instantclient11\sdk,shared" "--enable-object-out-dir=../obj/" "--enable-com-dotnet=shared" "--with-mcrypt=static" "--disable-static-analyze" "--with-pgo"