Debian 7.0 Wheezy PHP 5.3 Install (Downgrade from PHP5.4)

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

Debian Wheezy comes with PHP 5.4. If this is too new for your application and it doesn’t work properly, here is a short description on downgrading to PHP 5.3.

Add the following to /etc/apt/sources.lst

deb http://ftp.us.debian.org/debian/ squeeze main contrib non-free
deb-src http://ftp.us.debian.org/debian/ squeeze main contrib non-free

Create

/etc/apt/preferences.d/preferences

And add the packages you need downgraded such as in my case

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

#Package: libapache2-mod-php5

#Pin: release a=oldstable
#Pin-Priority: 700

Package: php-pear
Pin: release a=oldstable
Pin-Priority: 700

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

Then run the commands

aptitude update
aptitude reinstall <necessary packages>

 

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

 

  • First, add these two lines to /etc/apt/sources.list. In short, it adds Debian Squeeze repositories as an additional source of packages:

deb http://ftp.debian.org/debian/ squeeze main contrib non-free
deb http://security.debian.org/ squeeze/updates main contrib non-free

 

  • Then, add these to pin your old PHP 5.3 packages, to /etc/apt/preferences.d/preferences. If you don’t have this file, create an empty one.

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

Package: libapache2-mod-php5
Pin: release a=oldstable
Pin-Priority: 700

Package: libapache2-mod-php5
Pin: release a=oldstable
Pin-Priority: 700

Package: php-pear
Pin: release a=oldstable
Pin-Priority: 700

Package: php-apc
Pin: release a=oldstable
Pin-Priority: 700

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

 

  •  This will list your PHP packages

PHP=$(dpkg -l|grep php|grep 5.4.4|awk '{print $2}')

 

  • Finally, reinstall:

# apt-get update

# apt-get install –reinstall $PHP
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following extra packages will be installed:
libicu44 libjpeg62 libmagickcore3 libmagickwand3 libmysqlclient16 libt1-5 php5-suhosin
Suggested packages:
libmagickcore3-extra php5-dev
The following NEW packages will be installed:
libicu44 libjpeg62 libmagickcore3 libmagickwand3 libmysqlclient16 libt1-5 php5-suhosin
The following packages will be DOWNGRADED:
libapache2-mod-php5 php-apc php-pear php5 php5-cgi php5-cli php5-common php5-curl php5-gd php5-imagick php5-imap php5-intl php5-mcrypt php5-mysql
0 upgraded, 7 newly installed, 4 reinstalled, 14 downgraded, 0 to remove and 0 not upgraded.
Need to get 30.5 MB of archives.
After this operation, 30.9 MB of additional disk space will be used.
Do you want to continue [Y/n]?

Read More