Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to update my version of PHP from 5.2.0 to 5.2.14 (or later, but I don't want to upgrade to 5.3 yet for compatibilty reasons).

Every guide I find to upgrade PHP is for updating to the last available version, but I dont't find a way to update to a specific version.

The easiest and quickest the solution, the best.

Be gentle, I am not a linux expert by any means, so please: the easiest and quickest the solution, the best.

Thank you!

share|improve this question
2  
What version of Debian is it, and how did you install the PHP 5.2.0? –  Mike Scott Jan 19 '11 at 12:56

2 Answers 2

up vote 1 down vote accepted

update: Since I wrote this answer, Squeeze has since been released as Debian 6.0. That is, it should be called stable instead of testing.


If you want to find out if a specific version of a package is available in Debian, look at Packages page and use the search function there. Doing a search for "php5" gives:

lenny   (stable)   - 5.2.6.dfsg.1-1+lenny9
squeeze (testing)  - 5.3.3-7
sid     (unstable) - 5.3.3-7

Any other php5 version not listed there is not (officially) supported, so instead of 5.2.14, I recommend you upgrade to lenny's 5.2.6.

If you still insist on 5.2.14 I guess you should follow Andrew's advice.

notes:

  • The fact that you are still using 5.2.0 implies that you are probably still using an even older Debian release, Etch... not good.
  • Debian offers a snapshots service if you want unsupported software that was historically packaged. Use this only when you are really desperate for a specific version.
  • Doing a search there indicated that your 5.2.14 was never packaged in Debian (either that or the snapshot service was down, and it didn't get included).
share|improve this answer

I always reccomend building from source and installing to /usr/local. You can run two versions side-by-side as long as you remember which version you're running.

You don't mention which method your using, but we'll assume Apache with MODPHP.

It should be a simple case of going to php.museum.net and finding the version you need, then, something like the following (top of my head, no checking):

cd /usr/src
wget http://museum.php.net/php5/php-5.2.13.tar.gz
tar -xzvf php-5.2.13.tar.gz
cd php-5.2.13.tar.gz

The next line will let you find out what the build command was for your previous install, so you'll know what extensions you've got enabled. As you're already installed, you should have no problems with dependancies.

php -i | grep configure

Re-create the configure line, and the only changes you should need to make are adding a new prefix

./configure --prefix=/usr/local/php-5.2.13 <rest of configure as above>

then make & make install

Then you've just got to edit your apache httpd.conf file to point to the new location of libphp5 (just search and replace). You'll also find it helpful to sym link the new php location to something that won't change when you upgrade in future:

ln -s /usr/local/php-5.2.13 /usr/local/php

Now, your custom built version of php will always be in /usr/local/php as when you build php-5.3.5 you can change the symlink.

All that's left would be to re-install any PECL/PEAR extensions, using the full path to the binary /usr/local/php/bin/pear install <whatever> and copying the php.ini file you're currently using to the new location /usr/local/php/lib/php.ini

Now, you're no longer tied to the distribution packaged version of php, you can re-compile as required to add extensions, and, you're not reliant on third party to create packages for you.

It's more than likely that the old system package will still be in the path, you either need to remember this, and call the full path to the new php, or modify the relevant section of your system path to include the new version before the old.

Andrew

share|improve this answer

Your Answer

 
discard

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.