Ubuntu 13:10 - 将 php 5.5.3 降级至 5.4

Ubuntu 13:10 - 将 php 5.5.3 降级至 5.4

有人可以逐步指导我如何做到这一点吗?

我是否需要担心这样做会导致数据/数据库丢失?

谢谢!

sudo apt-get remove --purge dpkg -l | grep php | grep -w 5.5 | awk '{print $2}' | xargs

sudo apt-get install php5=5.4.23-1ubuntu3.4 php5-cli=5.4.23-1ubuntu3.4 php5-common=5.4.23-1ubuntu3.4 libapache2-mod-php5=5.4.23-1ubuntu3.4

sudo apt-get install php5=5.4.23-1ubuntu3.4 php5-cli=5.4.23-1ubuntu3.4 php5-common=5.4.23-1ubuntu3.4 libapache2-mod-php5=5.4.23-1ubuntu3.4

sudo apt-get install php-pear=5.4.23-1ubuntu3.4 php5-curl=5.4.23-1ubuntu3.4 php5-gd=5.4.23-1ubuntu3.4 php5-intl=5.4.23-1ubuntu3.4 php5-mysql=5.4.23-1ubuntu3.4 php5-pspell=5.4.23-1ubuntu3.4 php5-recode=5.4.23-1ubuntu3.4 php5-snmp=5.4.23-1ubuntu3.4 php5-sqlite=5.4.23-1ubuntu3.4 php5-tidy=5.4.23-1ubuntu3.4 php5-xmlrpc=5.4.23-1ubuntu3.4 php5-xsl=5.4.23-1ubuntu3.4

答案1

我的版本略有不同,但我四处寻找一种方法,不会卸载我一半的系统(带有费力的自定义配置),因为 PHP 自动从 5.4.28 升级到 5.4.29,这会破坏我们所有开发人员和 QA 的 Symfony 项目。

本质上,这是一夜之间发生的:

+ apt-get -y --force-yes -o Dpkg::Options::=--force-confdef upgrade
Reading package lists...
Building dependency tree...
Reading state information...
The following packages have been kept back:
  libspice-server1
The following packages will be upgraded:
  libapache2-mod-php5 php-pear php5 php5-cli php5-common php5-curl php5-gd
  php5-intl php5-ldap php5-mcrypt php5-mysql php5-readline
12 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
Need to get 6,221 kB of archives.
After this operation, 9,216 B of additional disk space will be used.
Get:1 http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu/ precise/main libapache2-mod-php5 amd64 5.4.29-2+deb.sury.org~precise+1 [2,678
kB]

ETC。

请注意,没有其他软件包被升级或更改。(那么为什么在回退时需要稍后删除它们?错了。)

在放弃了所有传统的“正确”方法来保持稳定的依赖关系之后,

最后,我跑了

aptitude versions php5 

看看有哪些可用资源。

出现了许多软件包,但看起来最核心的是 php5-common:

Package php5-common:i386:
p   5.3.10-1ubuntu3                                                            precise                                                 500
p   5.3.10-1ubuntu3.11                                                         precise-security,precise-updates                        500
p   5.4.28-1~ppa1~precise                                                      precise                                                 500
p   5.4.29-2+deb.sury.org~precise+1                                            precise                                                 500

5.4.29-2+deb.sury.org~precise+1 是今天早上导致问题的新更新:

显然我们需要降级到 5.4.28-1~ppa1~precise。但是,apt-get 和 synaptic 坚持删除许多无害且看似无关的软件包,我们需要保留这些软件包,这些软件包今天没有升级,并且确实依赖于某些版本的 PHP,但突然间并不特别依赖于 5.4.29-2+deb.sury.org~precise+1。

不,谢谢!

aptitude install php5-common=5.4.28-1~ppa1~precise

一开始,交互式运行给了我同样的选项。当我不断拒绝时,它不断提供更多建议。最后,大约第 5 个建议是这样的:

接受此解决方案吗?[Y/n/q/?] n 以下操作将解决这些依赖关系:

 Keep the following packages at their current version:

1)php5-common [5.4.29-2+deb.sury.org~precise+1(现在为precise)]

接受此解决方案吗?[Y/n/q/?] n 以下操作将解决这些依赖关系:

  Remove the following packages:

1)php5-readline

  Downgrade the following packages:

2) libapache2-mod-php5 [5.4.29-2+deb.sury.org~precise+1 (现在,precise) -> 5.4.28-1~ppa1~precise (precise)] 3) php-pear [5.4.29-2+deb.sury.org~precise+1 (现在,precise) -> 5.4.12-1~ppa1~precise (precise)] 4) php5-cli [5.4.29-2+deb.sury.org~precise+1 (现在,precise) -> 5.4.28-1~ppa1~precise (precise)] 5) php5-curl [5.4.29-2+deb.sury.org~precise+1 (现在,precise) -> 5.4.28-1~ppa1~precise (precise)] 6) php5-gd [5.4.29-2+deb.sury.org~precise+1 (现在,precise) -> 5.4.28-1~ppa1~precise (precise)] 7) php5-intl [5.4.29-2+deb.sury.org~precise+1 (现在,precise) -> 5.4.28-1~ppa1~precise (precise)] 8) php5-ldap [5.4.29-2+deb.sury.org~precise+1 (现在,precise) -> 5.4.28-1~ppa1~precise (precise)] 9) php5-mcrypt [5.4.29-2+deb.sury.org~precise+1 (现在,precise) -> 5.4.28-1~ppa1~precise (precise)] 10) php5-mysql [5.4.29-2+deb.sury.org~precise+1(现在,精确)-> 5.4.28-1~ppa1~precise(精确)]

  Leave the following dependencies unresolved:

11)php5-cli 推荐使用 php5-readline

这似乎已经足够好了!我可以稍后手动查看 php5-readline。

Accept this solution? [Y/n/q/?] y
The following packages will be DOWNGRADED:
  libapache2-mod-php5 php-pear php5-cli php5-common php5-curl php5-gd php5-intl php5-ldap php5-mcrypt php5-mysql
The following packages will be REMOVED:
  libonig2{u} libqdbm14{u} php5-readline{a}
0 packages upgraded, 0 newly installed, 10 downgraded, 3 to remove and 2 not upgraded.
Need to get 8,277 kB of archives. After unpacking 1,818 kB will be used.
Do you want to continue? [Y/n/?] Y
[100%] Writing extended state information

现在检查 php 版本:(php5-cli 被调用)

php -i |less

phpinfo() PHP 版本 => 5.4.28-1~ppa1~precise

 apt-cache policy php5-cli
php5-cli:
  Installed: 5.4.28-1~ppa1~precise
  Candidate: 5.4.29-2+deb.sury.org~precise+1
  Version table:
     5.4.29-2+deb.sury.org~precise+1 0
        500 http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu/ precise/main amd64 Packages
 *** 5.4.28-1~ppa1~precise 0
        500 http://ppa.launchpad.net/nathan-renniewaldock/ppa/ubuntu/ precise/main amd64 Packages
        100 /var/lib/dpkg/status
     5.3.10-1ubuntu3.11 0
        500 http://archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages
        500 http://archive.ubuntu.com/ubuntu/ precise-security/main amd64 Packages
     5.3.10-1ubuntu3 0
        500 http://archive.ubuntu.com/ubuntu/ precise/main amd64 Packages

伟大的!

相关内容