Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Seydina's avatar

Pdo_pgsql extension issue

Hi, I make sudo apt -y install php8.1-pgsql and uncomment ;extension=pdo_pgsql found in "etc/php/8.1/cli/php.ini" and restart apache but when I tried to connect to my postgres server with my php script I get this message : COULD NOT FIND DRIVER

0 likes
2 replies
jorqensen's avatar

The path /etc/php/8.1/cli/php.ini gives it away a bit, this is the configuration for your CLI PHP. You should be modifying the configuration for FPM that webservers make use of.

Seydina's avatar

@jorqensen I add to the end of php.ini file this directive "extension=pgsql.so" and everything works fine. I have not uncomment these lines : ";extension=pdo_pgsql and ;extension=pgsql found there" but I get this warning message when I start my server from PhpStorm terminal : "PHP Warning: Module "pgsql" is already loaded in Unknown on line 0" which I am trying to resolve

Please or to participate in this conversation.