Откат PHP с версии 5.4 до 5.3 в Ubuntu 12.10

Описание: Программирование в PHP
Модератор: Aleksandr

Дим M
Автор темы, Администратор
Администратор
Аватара
Дим M
Автор темы, Администратор
Администратор
Сообщения: 1608
Зарегистрирован: 5 апреля 2013
С нами: 10 лет 11 месяцев

#1 Дим » 16 декабря 2013, 20:51

Изображение


Это руководство объяснит, как откатить PHP с версии 5.4 до 5.3 в Ubuntu 12.10.

Замечание: используйте этот скрипт на свой страх и риск! Создайте бекап БД.

Инструкция

Для начала вам нужно загрузить shell-скрипт или создать файл (в root/root)

Содержимое файла

Код: Выделить всё

#!/bin/bash
#
# Original for 5.3 by Ruben Barkow (rubo77) [url]http://www.entikey.z11.de/[/url]
# release 1 PHP5.4 to 5.3 by Emil Terziev ( foxy ) Bulgaria

# Originally Posted by Bachstelze [url]http://ubuntuforums.org/showthread.php?p=9080474#post9080474[/url]
# 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
PHPLIST=$(for i in $(dpkg -| grep php|awk '{ print $2 }' ); do echo $i; done)
echo these pachets will be removed: $PHPLIST
# you need not to purge, if you have upgraded from precise:
aptitude remove $PHPLIST
# 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 $PHPLIST 
; do echo "Package: $i
Pin: release a=precise
Pin-Priority: 991
"
>>/etc/apt/preferences.d/php5_3; done

echo 
"# needed sources vor php5.3:
deb [url]http://bg.archive.ubuntu.com/ubuntu/[/url] precise main restricted
deb-src [url]http://bg.archive.ubuntu.com/ubuntu/[/url] precise main restricted

deb [url]http://bg.archive.ubuntu.com/ubuntu/[/url] precise-updates main restricted
deb-src [url]http://bg.archive.ubuntu.com/ubuntu/[/url] precise-updates main restricted

deb [url]http://bg.archive.ubuntu.com/ubuntu/[/url] precise universe
deb-src [url]http://bg.archive.ubuntu.com/ubuntu/[/url] precise universe
deb [url]http://bg.archive.ubuntu.com/ubuntu/[/url] precise-updates universe
deb-src [url]http://bg.archive.ubuntu.com/ubuntu/[/url] precise-updates universe

deb [url]http://bg.archive.ubuntu.com/ubuntu/[/url] precise multiverse
deb-src [url]http://bg.archive.ubuntu.com/ubuntu/[/url] precise multiverse
deb [url]http://bg.archive.ubuntu.com/ubuntu/[/url] precise-updates multiverse
deb-src [url]http://bg.archive.ubuntu.com/ubuntu/[/url] precise-updates multiverse
deb-src [url]http://bg.archive.ubuntu.com/ubuntu/[/url] natty-backports main restricted universe multiverse

deb [url]http://security.ubuntu.com/ubuntu[/url] precise-security main restricted
deb-src [url]http://security.ubuntu.com/ubuntu[/url] precise-security main restricted
deb [url]http://security.ubuntu.com/ubuntu[/url] precise-security universe
deb-src [url]http://security.ubuntu.com/ubuntu[/url] precise-security universe
deb [url]http://security.ubuntu.com/ubuntu[/url] precise-security multiverse
deb-src [url]http://security.ubuntu.com/ubuntu[/url] precise-security multiverse

deb-src [url]http://archive.canonical.com/ubuntu[/url] natty partner

deb [url]http://extras.ubuntu.com/ubuntu[/url] precise main
deb-src [url]http://extras.ubuntu.com/ubuntu[/url] precise main

deb [url]http://bg.archive.ubuntu.com/ubuntu/[/url] precise-backports main restricted universe multiverse
deb-src [url]http://bg.archive.ubuntu.com/ubuntu/[/url] precise-backports main restricted universe multiverse


deb [url]http://archive.canonical.com/ubuntu[/url] precise partner
deb-src [url]http://archive.canonical.com/ubuntu[/url] precise partner

"
 >> /etc/apt/sources.list.d/precise.list

aptitude update

apache2ctl restart

echo install new from precise
:
aptitude -t precise install $PHPLIST

# 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

apache2ctl restart

После того, как у вас будет загруженный файл php5_4_downgrade_5.3.sh или созданный, вам нужно будет изменить его права, выполнив:

Код: Выделить всё

sudo chmod 755 php5_4_downgrade_5.3.sh


Теперь вы можете выполнить этот скрипт с помощью следующей команды в терминале:

Код: Выделить всё

sudo sh php5_4_downgrade_5.3.sh
[center]i love you [s]mxIni[/s] Mysql[/center]


  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «PHP»

Кто сейчас на форуме (по активности за 5 минут)

Сейчас этот раздел просматривают: 3 гостя