Downgrade php 5.3 to 5.2 in Debian

HOW TO: Downgrade php 5.3 to 5.2 in Debian

20th November, 2011 – Posted by Rocko – No Comments

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:

dpkg -l | grep php

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

nano /etc/apt/sources.list

and add the following:

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

Now we will do something called pinning:

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

nano /etc/apt/preferences.d/preferences

Add in the file the following:

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

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

Now remove php with:

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

then update and reinstall with old version:

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

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

dpkg -l | grep php

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:

/etc/init.d/apache2 restart

About ngengeh

Nama gw ndry

Posted on March 8, 2012, in Belajar, Linux. Bookmark the permalink. 2 Comments.

  1. Thanks for your tutorial.
    Saves my life ;-D

  2. Thanks heaps, you just saved me from getting fired.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: