Skip to content

Instantly share code, notes, and snippets.

@gobinathm
Created March 14, 2018 13:02
Show Gist options
  • Save gobinathm/247a6d7ae408ed11c0b8f558ae8b053b to your computer and use it in GitHub Desktop.
Save gobinathm/247a6d7ae408ed11c0b8f558ae8b053b to your computer and use it in GitHub Desktop.
How to install PHP5.2 into newest versions of Ubuntu
#!/bin/bash
## read http://askubuntu.com/questions/61101/downgrade-php-to-php5-2
## read http://www.alexweber.com.br/en/tutorials/how-install-php-52-ubuntu-1010-lucid-and-1104-natty
# sudo apt-add-repository ppa:andphe/php
# sudo apt-get update
## find sources.list and replace your dist name by "lucid" for this ppa
## read http://serverfault.com/questions/52029/how-to-force-downgrade-of-packages-on-ubuntu-karmic
## read https://help.ubuntu.com/community/PinningHowto#Apt.2BAC8-Dpkg
## see https://launchpad.net/~andphe/+archive/ppa/+packages
PACKAGES="libapache2-mod-php5 php5-common php5-cli php5 php-pear php5-cgi php5-curl php5-dbg php5-dev php5-gd php5-gmp php5-ldap php5-mhash php5-mysql php5-odbc php5-pgsql php5-pspell php5-recode php5-snmp php5-sqlite php5-sybase php5-tidy php5-xmlrpc php5-xsl"
for PACKAGE in $(echo $PACKAGES | tr " " "\n")
do
echo "[INSTALLING $PACKAGE]"
apt-get install "$PACKAGE=5.2.17.dfsg.1-0ubuntu0ppa3~lucid"
echo "[HOLDING VERSION OF $PACKAGE]"
echo "$PACKAGE" hold | dpkg --set-selections
echo
echo
echo
done
apt-get update
apt-get upgrade
/etc/init.d/apache2 restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment