-
-
Save alex-vlasov/7320514 to your computer and use it in GitHub Desktop.
Downgrade php to 5.3 on ubuntu 13.10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Original for 5.3 by Ruben Barkow (rubo77) http://www.entikey.z11.de/ | |
# release 1 PHP5.4 to 5.3 by Emil Terziev ( foxy ) Bulgaria | |
# Originally Posted by Bachstelze http://ubuntuforums.org/showthread.php?p=9080474#post9080474 | |
# OK, here's how to do the Apt magic to get PHP packages from the precise repositories: | |
echo "Am I root? " | |
if [ "$(whoami &2>/dev/null)" != "root" ] && [ "$(id -un &2>/dev/null)" != "root" ] ; then | |
echo " NO! | |
Error: You must be root to run this script. | |
Enter | |
sudo su | |
" | |
exit 1 | |
fi | |
echo " OK"; | |
#install aptitude before, if you don`t have it: | |
apt-get update | |
apt-get install aptitude | |
# or if you prefer apt-get use: | |
# alias aptitude='apt-get' | |
# finish all apt-problems: | |
aptitude update | |
aptitude -f install | |
#apt-get -f install | |
# remove all your existing PHP packages. You can list them with dpkg -l| grep php | |
PACKAGES="libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap dh-make-php libapache2-mod-php5 php-pear php-apc php5 php5-cli php5-common php5-curl php5-dev php5-gd php5-imap php5-ldap php5-mysql php5-xdebug php5-xhprof apache2 apache2-bin apache2-data apache2-mpm-prefork apache2-mpm-event apache2-mpm-worker apache2-utils apache2.2-bin apache2.2-common libapache2-mod-php5"; | |
#PHPLIST=$(for i in $(dpkg -l | grep php|awk '{ print $2 }' ); do echo $i; done) | |
#APACHELIST=$(for i in $(dpkg -l | grep apache|awk '{ print $2 }' ); do echo $i; done) | |
echo these packages will be removed: $PACKAGES | |
# you need not to purge, if you have upgraded from precise: | |
aptitude purge $PACKAGES | |
# on a fresh install, you need purge: | |
# aptitude remove --purge $PHPLIST | |
#Create a file each in /etc/apt/preferences.d like this (call it for example /etc/apt/preferences.d/php5_2); | |
# | |
#Package: php5 | |
#Pin: release a=precise | |
#Pin-Priority: 991 | |
# | |
#The big problem is that wildcards don't work, so you will need one such stanza for each PHP package you want to pull from precise: | |
echo ''>/etc/apt/preferences.d/php5_3 | |
for i in $PACKAGES ; do echo "Package: $i | |
Pin: release a=precise | |
Pin-Priority: 991 | |
">>/etc/apt/preferences.d/php5_3; done | |
MIRRORURL='http://ftp.byfly.by/pub/ubuntu/' | |
echo ''>/etc/apt/sources.list.d/precise.list | |
echo "# needed sources for php5.3: | |
deb $MIRRORURL precise main restricted | |
deb-src $MIRRORURL precise main restricted | |
deb $MIRRORURL precise-updates main restricted | |
deb-src $MIRRORURL precise-updates main restricted | |
deb $MIRRORURL precise universe | |
deb-src $MIRRORURL precise universe | |
deb $MIRRORURL precise-updates universe | |
deb-src $MIRRORURL precise-updates universe | |
deb $MIRRORURL precise multiverse | |
deb-src $MIRRORURL precise multiverse | |
deb $MIRRORURL precise-updates multiverse | |
deb-src $MIRRORURL precise-updates multiverse | |
deb $MIRRORURL precise-security main restricted | |
deb-src $MIRRORURL precise-security main restricted | |
deb $MIRRORURL precise-security universe | |
deb-src $MIRRORURL precise-security universe | |
deb $MIRRORURL precise-security multiverse | |
deb-src $MIRRORURL precise-security multiverse | |
deb $MIRRORURL precise-backports main restricted universe multiverse | |
deb-src $MIRRORURL precise-backports main restricted universe multiverse | |
" >> /etc/apt/sources.list.d/precise.list | |
aptitude update | |
sudo service apache2 restart | |
echo install new from precise: | |
aptitude -t precise install $PACKAGES | |
# at the end retry the modul libapache2-mod-php5 in case it didn't work the first time: | |
aptitude -t precise install libapache2-mod-php5 | |
sudo service apache2 restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment