Installing PHP 5.2 on Ubuntu 10.04/10.10
The repositories on Ubuntu 10.04 and later only include PHP 5.3. If you want to use PHP 5.2. you can install the repository (PPA https://edge.launchpad.net/~txwikinger/+archive/php5.2 txwikinger/php5.2) with a required PHP version.
Below are four steps you need to go through in order to change your PHP version. If PHP is not installed yet, you need to connect the repository beforehand and install php5 in a usual way. PHP 5.2.10 will be installed.
Install the repository
add-apt-repository ppa:txwikinger/php5.2
Or add into /etc/apt/sources.list (if python-software-properties is missing, the command add-apt-repository will be missing as well)
deb http://ppa.launchpad.net/txwikinger/php5.2/ubuntu lucid main
#deb-src http://ppa.launchpad.net/txwikinger/php5.2/ubuntu lucid main
Add the PGP-key:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 9CC59506
Specify in the /etc/apt/preferences.d/php file
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
Package: php5-mcrypt
Pin: version 5.2.6*
Pin-Priority: 991
Package: php5-imap
Pin: version 5.2.6*
Pin-Priority: 991
Update the apt cash
apt-get update
Update the software (PHP 5.3 will be downgraded to PHP 5.2.10)
apt-get dist-upgrade
You have successfully completed the installation.
Troubleshooting
Unable to downgrade the PHP version (downgrade failed)
View the list of installed packets
dpkg -l | grep php
Specify a list of packets that you can locate in the system
apt-get remove php5
apt-get install php5
Install the missing packets.
No usable dialog-like program is installed
While installing the software on Ubuntu Linux (the VPS template is called ubuntu-10.04-minimal) the following error may occur:
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/ebconf/FrontEnd/Dialog.pm line 75, <> line 1.)
debconf: falling back to frontend: Readline
To resolve this problem you need to install the missing packages:
apt-get install dialog apt-utils
Gnupg does not seem to be installed
While installing the software on Ubuntu Linux (the VPS template is called ubuntu-10.04-minimal) the following error may occur:
Warning: gnupg does not seem to be installed.
Warning: apt-key requires gnupg for most operations.
Executing: gpg –ignore-time-conflict –no-options –no-default-keyring –secret-keyring /etc/apt/secring.gpg –trustdb-name /etc/apt/trustdb.gpg
–keyring /etc/apt/trusted.gpg –primary-keyring /etc/apt/trusted.gpg –keyserver keyserver.ubuntu.com –recv-keys 9CC59506
/usr/bin/apt-key: 212: gpg: not found
If you are using the minimal template, this error means that you need to install gnupg
apt-get install gnupg







