I am working with mapbender3 which is developed in symfony2 on my local machine. I am asked to connect the application to a remote potgreSQL server. Following is the configuration in the parameters.yml file.
parameters:
database_driver: pdo_pgsql
database_host: 192.168.3.100
database_port: 5434
database_name: idc_core
database_path: ~
database_user: *******
database_password: *******
mailer_transport: smtp
mailer_host: localhost
mailer_user: ~
mailer_password: ~
But when I run the command:
php app/console doctrine:database:create
I keep getting the below error
could not create database for connection named "idc_core"
cound not find driver
I am using WAMP server on windows 7 and the driver pdo_pgsql shows active and running on my local computer.
I have checked phpinfo() and it displayed pdo_pgsql as enabled but when I run php -m
in commandline to see the modules compiled in,
I can see PDO , pdo_mysql and pdo_sqlite but not pdo_pgsql
Be sure to configure the 'default'
key in app/config/database.php
For postgres, this would be 'default' => 'postgres',
If you are receiving a [PDOException] could not find driver
error, check to see if you have the correct PHP extensions installed. You need pdo_pgsql.so
and pgsql.so
installed and enabled. Instructions on how to do this vary between operating systems.
For Windows, the pgsql
extensions should come pre-downloaded with the official PHP distribution. Just edit your php.ini
and uncomment the lines extension=pdo_pgsql.so
and extension=pgsql.so
Also, in php.ini
, make sure extension_dir
is set to the proper directory. It should be a folder called extensions
or ext
or similar inside your PHP install directory.
Finally, copy libpq.dll
from C:\\wamp\\bin\\php\\php5.*\\
into C:\\wamp\\bin\\apache*\\bin
and restart all services through the WampServer interface.
If you still get the exception, you may need to add the postgres \\bin
directory to your PATH
:
PATH
entry. This should hopefully resolve any problems. For more information see:
You should add pdo_pgsql extension into the CLI config of your php in
yourPhpDirectory/cli/php.ini
CLI uses this config to work in command line, not the one for apache. This is the reason why phpinfo();
shows you pdo_pgsql and php -m
not. Also under Windows OS you should restart your command line tool to see differences after any config changes.
Enable both extensions php_pdo_pgsql
and php_pgsql
in php.ini
(the one for the CLI):
extension=php_pdo_pgsql.dll extension=php_pgsql.dll
Ensure that "Port" and "Login Credentials" for the remote server are correct by testing from a database administration tool, like Adminer.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.