Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 did sudo aptitude --purge remove php5, which removed successfully, except php5 is still installed on my system. How can I uninstall and re-install php5?


Thanks for the answers, I have these packages installed:

tony@bandop $ aptitude search php|grep "^i"
i A libapache2-mod-php5             - server-side, HTML-embedded scripting langu
i   php-pear                        - PEAR - PHP Extension and Application Repos
i   php5-cli                        - command-line interpreter for the php5 scri
i A php5-common                     - Common files for packages built from the p
i   php5-dev                        - Files for PHP5 module development         
i   php5-mysql                      - MySQL module for php5

I want to configure PHP to use a external PCRE library that I built. Do you know which package I have to reconfigure? Is there a way to specify config options when installing a package with aptitude?

share|improve this question

If you want to change the ./configure options if a package, you need to rebuild the package. The easiest way to do this is run:

# apt-get install build-essential devscripts
# apt-get source php5
# cd php5-*
# vim debian/rules 
# debuild -us -uc -b

You should now find the rebuild packages in the directory above the source. You can install these using "dpkg -i php5_1.2.3-4_amd64.deb" where the filename is the list of packages you want to install.

share|improve this answer
dpkg -l | grep php5

If you want to make sure that PHP is utterly purged;

apt-get remove --purge php5-common

Instructions to reinstall vary whether you're using mod_php5 or a CGI-based effort, there is also a CLI version, see 'apt-cache search php5' for a complete list of modules and bits.

You cannot supply ./configure arguments using Aptitude. What module are you missing and does it show up in 'apt-cache search php5-'? :) Most of them probably do!

You should just need to;

apt-get install libapache2-mod-php5

That'll pull in all the dependencies, then just restart Apache. You'll not be able to use your external PCRE library, but what does that give you over the packaged stuff from your distribution?

share|improve this answer
i updated the question. i have uninstalled successfully. now i need to know how to reinstall. i would love to use aptitude but i can't find any documentation telling me how to set "./configure" options. – Tony Jul 3 '09 at 21:19
Updated the post to reflect your changes – nixgeek Jul 3 '09 at 22:41
utf8 support for PCRE – Tony Jul 3 '09 at 23:13

How do you detect that php is still installed ? If php web pages continue to work, you need to remove libapache2-mod-php5 package.

List all installed php packages

aptitude search php|grep "^i"

If you find out that no package is installed, a manual php installation may have been performed. Look for its installation location with "locate php", and remove it.

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.