If PHP is installed as part of XAMPP, it will work with MySQL/MariaDB with no additional change. However, to work with a separately installed postgresql server, one must take some additional steps:
- Include PostgreSQL bin on windows path
- Remove the semicolon before the following lines from c:\<xampp install directory>\php\php.ini
extension=php_pdo_pgsql.dll extension=php_pgsql.dll
- Both dlls are already in the <xampp install directory>\php\ext directory. No copying necessary from external source.
- Restart the Apache server.
- Goto localhost on the web browser. Click on phpinfo. One should see support for the PDO and PDO_PGSQL drivers enabled.
- As a good test for the connection, also a good admin tool, download phppgadmin. Unzipp it in the htdoc directory. Invoke it through localhost/phppgadmin<version>. It should show up and connect to Postgresql server (if it is running!) I found this admin tool runs faster than Pgadmin.