Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I need to downgrade my PHP to 5.2.x from 5.3.x Certain software I currently use requires it. I found all these link explaining how to do it but they no longer work because they show you how to use the Karmic archives to downgrade but as those archives no longer exist on archive.ubuntu.com

share|improve this question
2  
PHP 5.2 has been end-of-lifed, you should probably move on to 5.3. If you are somehow dealing with code that works in 5.2 but does not in 5.3, you should focus your efforts on fixing that code instead. –  Charles Jan 6 '11 at 8:02
1  
Charles -- not an ideal world, mate. I'm trying to do this because PEAR is hosed on 5.3. I'm sick of the deprecation warnings. –  Mike Crowe Feb 4 '11 at 17:16
1  
In that case I'd suggest changing the error_reporting setting in php.ini to exclude E_DEPRECATED. So it would be something like E_ALL & ~E_NOTICE & ~E_DEPRECATED. –  igorw Feb 12 '11 at 9:28
    
What's wrong with 5.3? –  psusi Jan 19 '12 at 15:43
1  
what's your point, you need php 5.2 instead of php 5.3 which is proposed by default? –  user86682 Aug 31 '12 at 9:00
show 4 more comments

9 Answers

I found this script on the ubuntu forums which worked for me

http://ubuntuforums.org/showthread.php?t=1566808

On ubuntu 10.10 you'll need to install aptitude as it is no longer installed by default.

sudo apt-get install aptitude
share|improve this answer
add comment

try one of these links: first second

share|improve this answer
add comment

Even when there is no Karmic repos available, you could use older ones from 8.04. For Hardy is 5.2.4 available. So first solution is to use those links and make Karmic -> Hardy.

But mixing repos from two different realeases may become painful. So i don't suggest to add other realease to your apt sources. I prefer to install downloaded deb with dpkg -i php_whatever.deb and set it on hold. Last time i used hold, apt-get did not care about setting hold, so maybe you need to install aptitude and use it for further upgrades.

share|improve this answer
add comment

5.2 is unsupported and RIFE with security holes.

However if you must use it, you can probably port the hardy-security package forward, as it is 5.2.4. It will be supported until April of 2013.

Still, you're going to be in better shape running the distro version of PHP and fixing your PHP apps than trying to deal with old broken PHP.

share|improve this answer
add comment

Uset this script on Ubuntu forum. It worked for me flawlessly. But the 'first' link above has some invalid urls and the 'second' script above is customized for apache.

share|improve this answer
add comment

You should install PHP 5.2 from source.

First of all you have to download the sources, install the required dependencies, after that configure based on your needs and install.

The steps can be found here.

share|improve this answer
1  
Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. –  Eliah Kagan Aug 31 '12 at 10:05
add comment

Why not just try to install PHP through apt-get.

After you have apache up and running:

apt-get install php5 libapache2-mod-php5

/etc/init.d/apache2 restart

Test PHP

sudo vi /var/www/info.php

Type:

<?php phpinfo(); ?>

Call that file in a browser:

e.g. http://192.168.0.100/info.php

Source

If you want a specific version of php package you can create a file called /etc/apt/preferences.d/php

sufo gedit /etc/apt/preferences.d/php

Put the packages you want to install and corresponding versions, for example:

Package: libapache2-mod-php5 Pin: version 5.2.10* Pin-Priority: 991

Package: libapache2-mod-php5filter Pin: version 5.2.10* Pin-Priority: 991

Package: php-pear Pin: version 5.2.10* Pin-Priority: 991

Package: php5 Pin: version 5.2.10* Pin-Priority: 991

Package: php5-cgi Pin: version 5.2.10* Pin-Priority: 991

Package: php5-cli Pin: version 5.2.10* Pin-Priority: 991

Package: php5-common Pin: version 5.2.10* Pin-Priority: 991

Package: php5-curl Pin: version 5.2.10* Pin-Priority: 991

Package: php5-dbg Pin: version 5.2.10* Pin-Priority: 991

Package: php5-dev Pin: version 5.2.10* Pin-Priority: 991

Package: php5-gd Pin: version 5.2.10* Pin-Priority: 991

Package: php5-gmp Pin: version 5.2.10* Pin-Priority: 991

Package: php5-ldap Pin: version 5.2.10* Pin-Priority: 991

Package: php5-mhash Pin: version 5.2.10* Pin-Priority: 991

Package: php5-mysql Pin: version 5.2.10* Pin-Priority: 991

Package: php5-odbc Pin: version 5.2.10* Pin-Priority: 991

Package: php5-pgsql Pin: version 5.2.10* Pin-Priority: 991

Package: php5-pspell Pin: version 5.2.10* Pin-Priority: 991

Package: php5-recode Pin: version 5.2.10* Pin-Priority: 991

Package: php5-snmp Pin: version 5.2.10* Pin-Priority: 991

Package: php5-sqlite Pin: version 5.2.10* Pin-Priority: 991

Package: php5-sybase Pin: version 5.2.10* Pin-Priority: 991

Package: php5-tidy Pin: version 5.2.10* Pin-Priority: 991

Package: php5-xmlrpc Pin: version 5.2.10* Pin-Priority: 991

Package: php5-xsl Pin: version 5.2.10* Pin-Priority: 991

Then run:

sudo apt-get update

And try again the command for installing php:

apt-get install php5 libapache2-mod-php5 Source

share|improve this answer
    
Nop! that will install the latest one -> 5.3.10 not 5.2 –  Achu Aug 31 '12 at 11:05
    
I've updated my answer –  LnxSlck Aug 31 '12 at 12:37
add comment

For all php-related packages use the historical repositories from old-releases.ubuntu.com for the karmic Ubuntu release to downgrade to php 5.2

I created a script solution here: http://ubuntuforums.org/showpost.php?p=9201854&postcount=6

it adds the histroical sources to a file /etc/apt/preferences.d/php5_2 that locks all php-related packages to karmic.

your system will stil stay on the actual release (11.10) onnly php will be taken from the old release

share|improve this answer
add comment

I would suggest you install the following:

sudo apt-get install php5=5.2.12.dfsg.1-2

share|improve this answer
add comment

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.