Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

creating database from postgreSQL with symfony

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

like image 216
Reza Saberi Avatar asked Nov 07 '15 05:11

Reza Saberi


People also ask

Can I use PHP with PostgreSQL?

There are two ways we can connect to the PostgreSQL database: Using the PHP command line interface. Using PHP API.

Which programming language is used by PostgreSQL?

The supported programming languages for PostgreSQL include . Net, C, C++, Delphi, Java, JavaScript (Node. js), Perl, PHP, Python and Tcl, but PostgreSQL can support many server-side procedural languages through its available extensions.

Can PostgreSQL be used commercially?

A: PostgreSQL is released under the OSI-approved PostgreSQL Licence. There is no fee, even for use in commercial software products.


1 Answers

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.

like image 112
slider_if Avatar answered Sep 25 '22 17:09

slider_if