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

Is there a way to work out if PHP was installed as part of a generic apt-get package, compiled from source or installed some other way on Ubuntu?

I need to recompile it with some more options and I want to try and follow the correct upgrade path.

share|improve this question
If you're going to compile it with different options, consider making a package of your version, so that it can be tracked in the future... – ghoti Dec 16 '11 at 12:19
up vote 5 down vote accepted

You can check if the package is installed with:

 dpkg -l |grep php

and can check if the files on your system is consistent with the package with

 debsums packagename

from this you can have some clues about the origin of the package.

share|improve this answer

you may want to run as root

root@machine:~# dpkg -l php5 (or whatever version you have)

if php was installed using packet manager, this command will retun some thing like

root@machine:~# dpkg -l php5
| Status=Not/Inst/Cfg-files/Unpacked/Failed-cfg/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                   Version                                Description
ii  php5                                   5.3.2-1ubuntu4.10                      server-side, HTML-embedded scripting language (metapackage)

notice the content of the first comumn wich is "ii" else , you will have the same output but with the first column containing "un" instead of ii

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.