Downgrading to PHP 5.3 on Debian Wheezy (7.0)
From lxadm | Linux administration tips, tutorials, HOWTOs and articles
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.
- 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://archive.debian.org/debian/ squeeze-lts main contrib non-free deb http://archive.debian.org/debian/ squeeze 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: version 5.3* Pin-Priority: 700 Package: libapache2-mod-php5 Pin: version 5.3* Pin-Priority: 700 Package: php-pear Pin: version 5.3* Pin-Priority: 700 Package: php-apc Pin: version 3.1.3p* 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}') # echo $PHP
- 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]?