PHP downgrade Debian

HOW TO: Downgrade php 5.3 to 5.2 in Debian

[social_share style=”circle” align=”horizontal” heading_align=”inline” facebook=”1″ twitter=”1″ google_plus=”1″ linkedin=”1″ pinterest=”1″ /]Has it happened to you, that you made an update and suddenly your programs using php are not working any more??? Well with this HOW TO you will learn how to downgrade php to an earlier version.

I have to say, this tutorial might work downgrading to any php version just with adjusting some parameters.

First lets begin with listing the php packages we have installed to make sure we have php 5.3

So in the console write:

[code]dpkg -l | grep php[/code]

Search for the php version, it should say 5.3.x if so, then you are int he correct path ๐Ÿ™‚

Now let’s add in /etc/apt/sources.list

[code]nano /etc/apt/sources.list[/code]

and add the following:

[code]deb ftp://ftp2.de.debian.org/debian/ lenny main contrib non-free
deb-src ftp://ftp2.de.debian.org/debian/ lenny main contrib non-free[/code]

Now we will do something called pinning:

Create a file in /etc/apt/preferences.d and call it preferences

[code]nano /etc/apt/preferences.d/preferences[/code]

Add in the file the following:

[code]Package: php5*
Pin: release a=oldstable
Pin-Priority: 700

Package: *
Pin: release a=stable
Pin-Priority: 600[/code]

Now remove php with:

[code]aptitude remove `dpkg -l | grep php| awk ‘{print $2}’ |tr “\n” ” “`[/code]

then update and reinstall with old version:

[code]apt-get update
apt-get -t oldstable install `dpkg -l | grep php5| awk ‘{print $2}’ |tr “\n” ” “`[/code]

Now check again to see if the old php version is installed doing again:

[code]dpkg -l | grep php[/code]

Check if you have now php 5.2.x if so then everything is set!! Might be that you have to reboot your apache or your web server doing:

[code]/etc/init.d/apache2 restart[/code]

[social_share style=”circle” align=”horizontal” heading_align=”inline” text=”” heading=”” facebook=”1″ twitter=”1″ google_plus=”1″ linkedin=”1″ pinterest=”1″ link=”” /]


Comments

10 responses to “HOW TO: Downgrade php 5.3 to 5.2 in Debian”

  1. i’have an error:

    E: Package ‘libapache2-mod-php5’ has no installation candidate
    E: Package ‘php5-cgi’ has no installation candidate
    E: Package ‘php5-cli’ has no installation candidate
    E: Package ‘php5-common’ has no installation candidate
    E: Package ‘php5-curl’ has no installation candidate
    E: Package ‘php5-gd’ has no installation candidate
    E: Package ‘php5-idn’ has no installation candidate
    E: Package ‘php5-imagick’ has no installation candidate
    E: Package ‘php5-imap’ has no installation candidate
    E: Package ‘php5-mcrypt’ has no installation candidate
    E: Package ‘php5-memcache’ has no installation candidate
    E: Package ‘php5-ming’ has no installation candidate
    E: Package ‘php5-mysql’ has no installation candidate
    E: Package ‘php5-ps’ has no installation candidate
    E: Package ‘php5-pspell’ has no installation candidate
    E: Package ‘php5-recode’ has no installation candidate
    E: Package ‘php5-snmp’ has no installation candidate
    E: Package ‘php5-sqlite’ has no installation candidate
    E: Package ‘php5-suhosin’ has no installation candidate
    E: Package ‘php5-tidy’ has no installation candidate
    E: Package ‘php5-xmlrpc’ has no installation candidate
    E: Package ‘php5-xsl’ has no installation candidate

    1. @Giuseppe did you add the correct repo in /etc/apt/sources.list ?

  2. Not working ๐Ÿ™ after update it’s still 5.3.3

    1. most probably you entered something wrong ๐Ÿ™‚

  3. Wesley Avatar
    Wesley

    No he’s not doing something wrong ๐Ÿ™‚ The Lenny mirrors are down ๐Ÿ˜›

    1. Wesley, you are 100% right! I forgot about that ๐Ÿ™‚

  4. Sebastian Ortiz Avatar
    Sebastian Ortiz

    Hi, i followed your guide to downgrade from wheezy to lenny.

    Some remarks:

    Use the archive repositories.

    Use pin release a=lenny

    Remove ibapache2-mod-php5 with –purge, so the configuration files are also remove, if not apache will not start.

    Thank you,

  5. Please rewrite your blog!

    dpkg -l | grep php

    mc -e /etc/apt/sources.list
    deb http://archive.debian.org/debian/ lenny main
    deb-src http://archive.debian.org/debian/ lenny main

    mc -e /etc/apt/preferences.d/preferences
    Package: php5*
    Pin: release a=lenny
    Pin-Priority: 700

    Package: *
    Pin: release a=stable
    Pin-Priority: 600

    aptitude remove `dpkg -l | grep php| awk ‘{print $2}’ |tr “\n” ” “`

    apt-get remove libkrb53
    apt-get install libkrb53

    apt-get install apache2-mpm-prefork

    apt-get -t lenny install `dpkg -l | grep php5| awk ‘{print $2}’ |tr “\n” ” “`

    dpkg -l | grep php

    apt-get install phpmyadmin

    /etc/init.d/apache2 restart

    Thanks!

  6. Cephalexin 250 Achat Baclofen En Canada Clomid Et Grossesse Extra Uterine [url=http://genericviabuy.com]viagra[/url] Cialis Heure Canadian Meds 24hr