Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I tried to remove PHP from ubuntu:

sudo aptitude purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "`

But without results.

when I run php -v in terminal I get PHP 5.3.25-dev

How I can remove ?


share|improve this question
What do you get if you simply run dpkg -l | grep php – bodhi.zazen Apr 26 '13 at 18:47
when I run 'dpkg -l | grep php' I received new empty line – Alex Apr 26 '13 at 19:50
How did you install it ? from source ? – bodhi.zazen Apr 26 '13 at 20:06
thanks for support, I solved – Alex May 1 '13 at 10:29

You did install the PHP5 from the source. PHP 5.3.25 was never part of Ubuntu release.

Hopefully if you did install it into a /usr/local, it could be removed by just going through the files in the /usr/local directories and remove files which seems to be belonging to PHP. If you did install PHP to /usr, then it could be more complicated, and it might require the original source directory where you have compiled the PHP.

If you still have PHP source directory you might want to try doing 'make uninstall' from the source directory, or if that command doesn't work, you could do another 'make install', noting the files which gets installed and removing them manually later.

However this is not really an Ubuntu related question.

It's never a good idea to install software directly from the sources, if you don't know exactly what you are doing.

P.S.: You might want to try the poor man's man "packaging" system - stow - next time to manage installed files in a sane way.

share|improve this answer
your answer is opened my eyes and I solved. Thanks @oerdnj – Alex May 1 '13 at 10:32
up vote 0 down vote accepted
whereis php
php: /usr/local/bin/php /usr/local/lib/php
sudo rm -rf /usr/local/bin/php /usr/local/lib/php
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.