I installed PostgreSQL and the php PDO driver on my 14.04 Ubuntu like this:
sudo apt-get install postgresql postgresql-contrib
sudo apt-get install php5-pgsql
Which installed PostgreSQL 9.3 and worked fine, but now I want to run 9.5.
So I updated the postgresql packages by adding the PostgreSQL repo following this guide and updating the packages.
However phpinfo still reports 9.3 after restarting apache:
PostgreSQL(libpq) Version 9.3.10
I can imagine that I somehow also have to update the php5-pgsql package? But then how? Or should I do something else?
Best Answer
Ok I resolved this issue but was struggling for some time, so I don't know exactly what the easiest method is to do. But I will describe a recipe which will probably work for others as well.
The first important note is: I think I resolved the issue since I can use the new upsert feature introduced in 9.5 (INSERT .. ON CONFLICT DO UPDATE ..). However my phpinfo() still reports version 9.3.
One more word about the problem situation: After adding the PostgreSQL repo and doing
apt-get upgrade
I had two version of PostgreSQL apparently.So to fix I did:
You will get a list of all the related packages installed. I deinstalled them all with --purge (this will probably remove all your databases as well, no problem in my case since they were empty).
It gave me errors on some packages but when I repeated it, in the end all packages were gone. Also do this for the php pdo driver:
Now install postgresql again, only 9.5 will be installed.