I would like to know if there is any repository I can add to install php5.2.9+ on Ubuntu Server 12.04.
3 Answers
PHP 5.2 was sent to end of life in December of 2010, so while there's a small chance you might find a PPA or .deb file in some dark alley of the Internet, you're very likely going to have to compile it from source if you want it to run on Ubuntu 12.04. Additionally, it's possible you'll run into problems with dependencies (particularly if anything has changed their API), so keep that in mind.
That said, you can find the latest source for the PHP 5.2 series on their GitHub (I found the 5.2.17 tag for you), and compile it using make. The PHP site also offers information on compiling PHP. The required versions will be different, but it's typically a "this version or greater" unless you get into major release differences (1.0 to 2.0, for example).
As a side note, it might be worth putting pressure on the people that maintain your external application to upgrade to at least the 5.3 series, or better yet, the 5.4 series. There have been a ton of bug fixes and security patches since then. Additionally, most tools don't support 5.2 anymore (which means you don't get things like Xdebug or PHPUnit without a fight, making maintaining an application of decent size and reasonable importance damn near impossible (I've been there)). The upgrade may not be something that can be done right away, thanks to changes between 5.2 and 5.3, but it generates customer demand and helps break down the delusion that a lot of companies have of "well, our userbase doesn't want this, so we're not going to offer it" (even though the reason they don't demand it is because it was absent from the product and they found workarounds, nevermind the fact that if the product offered it, the customers would use it).
- 3,034
I had never done it on Ubuntu, but yes in Debian Squeeze using the respository of Debian Lenny.
As the packages of PHP are all from Debian I think that this tutorial will server for Ubuntu.
Edit the repository list.
sudo nano /etc/apt/sources.listAdd the next line to ther /etc/apt/sources.list:
deb http://archive.debian.org/debian-archive/debian/ lenny main contrib non-freeUpdate the information of repos
sudo apt-get updateEdit the preferences of apt...
sudo nano /etc/apt/preferences.d/php.confAdd the next conf:
Package: php5* Pin: release a=oldstable Pin-Priority: 700 Package: * Pin: release a=stable Pin-Priority: 600Install sudo apt-get install php5 -t oldstable
Check that is the 5.2* version installed
sudo dpkg -l | grep php5
I repeat... not tested... just what i do on Debian ...
Original source: http://www.gustavopilla.com/2012/01/21/php-5-2-en-debian-squeeze/
- 11
- 1
Anyone who ends up here should consider following this tutorial.
It explains in details how to compile and setup PHP 5.2 alongside the supported PHP version and how to use in only on the needed vhost.