How to install php7.2-pgsql driver on Ubuntu Linux
In this post, we will learn how to install the php7.2-pgsql module on Ubuntu Linux, so actually someday before I have configured Postgresql database on Linux system and we want to test some replication on azure but the difficulty I’m facing to install the php7.2-pgsql library so I can connect our database through my PHP code.
If you don’t have a postgresql driver then it will fetch below error message, this error came because our system does not have the php7.2-pgsql module installed.
An uncaught Exception was encountered Type :- Error Message :- Call to undefined function pg_connect()
Step 1. Update the system
# sudo apt-get update # sudo apt-get upgrade
Step 2. Add the ppa repository
# sudo add-apt-repository ppa:ondrej/php
Now again update cache list of repository using below command
# sudo apt-get update
Step 3. Install the pgsql driver
Now, we can install the postgresql driver which helps us to connect Postgres database through our code.
# sudo apt install php7.2-pgsql
Note:- If you have already installed any older version of the pgsql driver then first remove that, then install the php7.2-pgsql otherwise you will face package conflict error.
That’s all in this post ! Thank you
I am a professional Cloud Engineer and founder of LinuxFork. I am working on Infrastructure Deployment and focusing on the integration of open source technologies with the Cloud. I am an avid Linux lover and open source enthusiast. mostly, I am working with Redhat and Ubuntu Linux in the production environment. apart from this I always believe in knowledge sharing.