I seem to have a very weird issue where the version of my php_pdo_pgsql extension when used through CLI is different to the version used in the browser.
Current setup:
OS: Windows 11
PHP Version: 8.1.3 Thread Safe x64
Apache Version: 2.4.57
I’m not using a wamp / xampp installation. Apache is a standalone installation so I can swap PHP versions with somewhat relative ease 😛
So when I run my PHP script in the browser I get the error
Fatal error: Uncaught PDOException: SQLSTATE[08006] [7] SCRAM authentication requires libpq version 10 or above in C:Repoversion_issueindex.php on line 2
PDOException: SQLSTATE[08006] [7] SCRAM authentication requires libpq version 10 or above in C:Repoversion_issueindex.php on line 2
But when I run it through CLI it works O.o
Here’s my test script:
<?php
$Database = new PDO("pgsql:host=localhost;port=5432;dbname=postgres;user=postgres;password=*******");
echo 'connected';
?>
Here’s where it gets weird…
When I use phpinfo() in the browser my pdo_pgsql libpq version is 9.6.12.
When I use php -i in the CLI (command prompt) the version is 11.4.
I’m using the PDO php_pdo_pgsql extension that came packaged with PHP when I downloaded it.
And before you ask… yes, both CLI and browser (Apache) are using the same PHP version, and directory.
CLI PHP Config Path
CLI pdo_pgsql Version
phpinfo PHP Config Path
phpinfo pdo_pgsql Version
So, before I seriously start questioning my life choices, does anyone have any idea how, or why, this is even possible???
Googling only gives results for different PHP versions between browser and CLI, but nothing about different versions for an extension.
5