How Do You Fix the Problem “Unable to locate package php-pgsql”?

Problem scenario
You are trying to integrate PHP and Postgresql on you Ubuntu/Debian Linux OS.  You run this command:  sudo apt-get -y install ​php-pgsql

You receive this error:
"Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package ​php-pgsql"

What should you do?

#1  Find out what version of php you have.  Run this:
php --version

#2  If you have version 5, run this: sudo apt-get -y install php5-pgsql

If you have version 7, run this: sudo apt-get -y install php7.0-pgsql

#3  Install libapache2-mod-php.  Run this command:
sudo apt-get -y install libapache2-mod-php

Leave a comment

Your email address will not be published. Required fields are marked *