Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between php_pdo_pgsql and php_pgsql PHP extensions?

My default php.ini file lists both extensions (installed via brew), and I sometimes see different variations on Linux (AMZN vs Centos) with the _pdo_ bit. What is the difference?

Update: I was getting errors saying pg_connect not found and this seems to be part of the non-PDO version. To get this installed on Mac via brew, I needed to add support by running brew reinstall php56 --with-postgresql

like image 375
Nic Cottrell Avatar asked Feb 06 '23 21:02

Nic Cottrell


2 Answers

PDO is short for PHP Data Objects and is an abstraction that can be mapped on to a lot of different databases. This means you can move between things like MySQL, PGSQL and SQLite very easily. The PDO module enables the functions you see here for PGSQL.

The non-PDO module is specific to Postgres and will enable this set of non-standardized functions that will only work with Postgres databases.

like image 77
Chris Avatar answered Feb 09 '23 11:02

Chris


The PDO extension can connect to different database management systems with the same syntax, as long as there's a driver for the system you want to use. The PostgreSQL extension can only connecto to PostgreSQL.

What you see is the PostgreSQL extension and the PDO driver for PostgreSQL.

like image 34
Álvaro González Avatar answered Feb 09 '23 11:02

Álvaro González