Not able to enable postgres for php 7.1

1.7k views Asked by At

I want to enable the postgres and I am not able to.

To make sure postgres is installed on my mac I ran the command postgres -V and I can see postgres (PostgreSQL) 9.6.1 as an out put so that confirms postgres is installed.

I ran the command php -v and the out i see is PHP 7.1.0.

Looking at the phpinfo I opened the .ini file and un commented the following two from it.

extension=php_pdo_pgsql.dll
extension=php_pgsql.dll

and I still do not see postgres in my phpinfo however I see the following warning in console.

Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php71/7.1.0_11/lib/php/extensions/no-debug-non-zts-20160303/php_pdo_pgsql.dll' - dlopen(/usr/local/Cellar/php71/7.1.0_11/lib/php/extensions/no-debug-non-zts-20160303/php_pdo_pgsql.dll, 9): image not found in Unknown on line 0

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php71/7.1.0_11/lib/php/extensions/no-debug-non-zts-20160303/php_pgsql.dll' - dlopen(/usr/local/Cellar/php71/7.1.0_11/lib/php/extensions/no-debug-non-zts-20160303/php_pgsql.dll, 9): image not found in Unknown on line 0

I am setting up laravel valet, every project seems to be working perfectly fine with mysql but any project that is using postgres throws the error

DriverException in AbstractPostgreSQLDriver.php line 91:
An exception occured in driver: could not find driver

From command line I am able to connect with the database using the command psql databasename and run any query so I am not sure what the problem is.

I will really appreciate any help on what I am missing.

Update 1

I commented the the following two in phpini and atleast the warning went away on terminal however i still cant get the postgres to work.

extension=php_pdo_pgsql.dll
extension=php_pgsql.dll
1

There are 1 answers

0
mohavee On

I solved the problem by updating PHP to version 7.1.5.