Server Fault is a question and answer site for system and network administrators. 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 previously setup my server by downloading php from, and using the configure, make make install to get it onto my apache centos server.

Now I want to upgrade and I'm not sure how to do it.

If I do what is said here: It will attempt to upgrade php to 5.3.8. that's not an issue for me, but my concern is that it won't work because I have php 5.2.14 installed through the compile, rather than through YUM

What should I do - is there a way to save the current state of the server in order to reverse changes if it breaks?

Does anyone have any experience with this?



share|improve this question
up vote 2 down vote accepted

If you want to switch to maintained packages, once you have been compiling from source it's safest to remove all of the files from your previous installation first. Note that some of these files may have been edited by yourself (such as php.ini) so you should take a backup of all of them first.

To do this, download the original source code (5.2.14) and compile and install it again but this time run your configure command with --prefix=/home/jason/build/ and create the build/ directory in your home. When you run make install, all of the files will be installed in the build directory. Running cd ~/build/; find . -type f > ~/php-5.2.14-file-list.txt will give you a list of all the files that you installed when you originally compiled PHP.

Once you have deleted all those files, check all the directories it installed ( cd ~/build/; find . -type d ) and for each of those, if it's empty you can remove it.

After that you should be safe to switch to RPMs without any fear of having two different version of PHP installed in different paths on your system.

share|improve this answer
Great answer. To remove the gunk use this command: mkdir /tmp/phpbuild3/; find -type f -exec mv /usr/local/{} /tmp/phpbuild3 \;. My /usr/local/ dir was the original prefix on my build (check your phpinfo(); output for the ./configure cmd. You can just copy and paste that, run it with the new prefix and this method works a charm Thank you!! – Jason Apr 28 '12 at 9:24

It is not recommended to install the same package twice: one from source and one from yum. If you do so, you may end up having the package installed in two different locations (duplicated files). This may cause you troubles and confusion.

I suggest you try to upgrade by downloading the new source code and build it as you have done this before. Your system will not be changed unless you type make install.

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.