0

I am setting up my Symfony 3 project (using Netbeans IDE) and want to use PostgreSQL as my database instead of MySQL. After some time online I have found a few potential solutions (one of which is mentioned here but this one does not seem to work for me). So:

  1. My symfony 3 project is running on the local MAMP server
  2. PostgreSQL server is running on the local machine as well
  3. I have setup my parameters.yml file as per below:
- database_driver: pdo_pgsql
- database_host: localhost
- database_port: 5432
- database_name: mypgdatabase
- database_user: mypguser
- database_password:  mypguserpass

The error that i am getting when generating entities is:

  [Doctrine\DBAL\Exception\DriverException]              

  An exception occurred in driver: could not find driver

  [Doctrine\DBAL\Driver\PDOException]  

  could not find driver

  [PDOException]             could not find driver

Been trying to figure this one out for a few days now so any help will he highly appreciated.

2
  • 1
    Do you have PHP’s PDO pgsql module installed ? Commented Jun 16, 2016 at 14:27
  • Not sure, how would i check for that? Commented Jun 16, 2016 at 14:42

2 Answers 2

1

Have you checked in your "php.ini" file that you have this:

extension=pdo.so
extension=php_pdo_pgsql.so

The php.ini file location might depend on which operating system you are using, if it's a mac run:

$ locate php.ini
Sign up to request clarification or add additional context in comments.

4 Comments

Thanks Alvin Bunk, i am using mama server on OS X and non of the above is in my php.ini file. Next question is who do i get those extantions installed. the one that i do have tho is ;extension=php_pdo_pgsql.dll however it is commented out and extension=pdo.so is missing as such.
Try uncommenting ;extension=php_pdo_pgsql.dll (remove the semicolon) and see what happens. You might need to restart Apache.
uncommented and restarted MAMP, getting these errors now: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20121212/php_pdo_pgsql.dll' - dlopen(/usr/lib/php/extensions/no-debug-non-zts-20121212/php_pdo_pgsql.dll, 9): image not found in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20121212/php_pgsql.dll' - dlopen(/usr/lib/php/extensions/no-debug-non-zts-20121212/php_pgsql.dll, 9): image not found in Unknown on line 0
You might have to install PostgreSQL support for PHP. Take a look at this question and the answer in particular. My original answer is correct though, and you should mark it as the correct answer. You need to figure out how to enable the php_pdo_pgsql.so module.
1

This is an easy way to check for PHP modules

php -m | grep 'pdo\|pgsql'

It looks like you need both PDO_pgsql and pgsql

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.