How To Install php-pgsql.x86_64 on Amazon Linux 2

In this tutorial we learn how to install php-pgsql.x86_64 in Amazon Linux 2. php-pgsql.x86_64 is A PostgreSQL database module for PHP

Introduction

In this tutorial we learn how to install php-pgsql.x86_64 on Amazon Linux 2.

What is php-pgsql.x86_64

The php-pgsql add PostgreSQL database support to PHP. PostgreSQL is an object-relational database management system that supports almost all SQL constructs. PHP is an HTML-embedded scripting language. If you need back-end support for PostgreSQL, you should install this package in addition to the main php package.

We can use yum to install php-pgsql.x86_64 on Amazon Linux 2. In this tutorial we discuss both methods but you only need to choose one of method to install php-pgsql.x86_64.

Install php-pgsql.x86_64 on Amazon Linux 2 Using yum

Update yum database with yum using the following command.

sudo yum makecache --refresh

After updating yum database, We can install php-pgsql.x86_64 using yum by running the following command:

sudo yum -y install php-pgsql.x86_64

How To Uninstall php-pgsql.x86_64 on Amazon Linux 2

To uninstall only the php-pgsql.x86_64 package we can use the following command:

sudo yum remove php-pgsql.x86_64

php-pgsql.x86_64 Package Contents on Amazon Linux 2

/etc/php.d/pdo_pgsql.ini
/etc/php.d/pgsql.ini
/usr/lib64/php/modules/pdo_pgsql.so
/usr/lib64/php/modules/pgsql.so

References

Summary

In this tutorial we learn how to install php-pgsql.x86_64 on Amazon Linux 2 using yum.