Uninstalling php 5.3 in ubuntu 14.04

2k views Asked by At

I have installed php 5.3 manually by executing commands like make & make install. But I need to upgrade it to v5.5 therefore I deleted all the directories related to php5 using sudo command.

But when I run php -v Still I am getting

PHP 5.3.29 (cli) (built: Jun 8 2015 05:53:32) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2014 Zend Technologies

Please help me to remove

1

There are 1 answers

0
Inderjeet Singh On BEST ANSWER

The below answer credit goes to Maythux

To uninstall something you installed from source, you would use cd back into the directory you built it from and then run sudo make uninstall but I don't think this will work with PHP since it doesn't have an uninstall.

So what you can do is to make a package from the existing compiled version you have and then you could install the new created package over the old one, and if this works you can remove it. First install checkinstall if you dont have it:

sudo apt-get install checkinstall

Then run:

 cd php-5.3.29
 sudo checkinstall

Accept all the defaults.The result will be a phpXX.deb package, so try to install it, this will replace the old files from the compiled package:

sudo dpkg -i phpXX.deb

If this goes smooth then you are near to have it. Now purge the package:

 sudo apt-get purge phpXX.deb

What to do if this doesn't work

you should remove all files manually

locate php5

Then remove the files and install a new version with apt-get again