apt-get 無法從舊穩定來源安裝最新的 PHP 5.4

apt-get 無法從舊穩定來源安裝最新的 PHP 5.4

我有兩台運行 13.04 的伺服器,並且在某個時候我添加了舊穩定包源對於 PHP 5.4。由於某種原因,我無法再更新它 — 一台伺服器無法從 5.4.23 升級到 5.4.24,而另一台伺服器在進行一些故障排除卸載後仍停留在預設軟體套件來源中的 5.4.9 。

以下是一台伺服器上安裝的正確版本:

PHP 5.4.23-1+sury.org~raring+1 (cli) (built: Dec 12 2013 09:25:05)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

這是我在另一台伺服器上所做的:

# add-apt-repository ppa:ondrej/php5-oldstable
# apt-get update && apt-get upgrade

但是,我得到的是舊版本:

# php -v
PHP 5.4.9-4ubuntu2.4 (cli) (built: Dec 12 2013 04:29:20)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies

我已經做了一個apt-get remove php* --purge,然後又做了一個apt-get install php5,但沒有骰子:它把我從 5.4.23 降到了 5.4.9。


這是我需要安裝的正確選擇:

# dpkg --get-selections | grep php
libapache2-mod-php5         install
php-apc                     install
php-pear                    install
php5                        install
php5-cli                    install
php5-common                 install
php5-curl                   install
php5-gd                     install
php5-imagick                install
php5-mysql                  install

快取甚至不顯示 PPA:

# apt-cache policy php5
php5:
  Installed: 5.4.9-4ubuntu2.4
  Candidate: 5.4.9-4ubuntu2.4
  Version table:
 *** 5.4.9-4ubuntu2.4 0
        500 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ raring-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ raring-security/main amd64 Packages
        100 /var/lib/dpkg/status
     5.4.9-4ubuntu2 0
        500 http://eu-west-1.ec2.archive.ubuntu.com/ubuntu/ raring/main amd64 Packages

答案1

您無法安裝所需的軟體包的原因是它不再位於您新增的 PPA 中。用於 raring 的 php5 5.4.23-1+sury.org 已從 PPA 中刪除。

以下是 2013 年 12 月 16 日的購電協議:http://web.archive.org/web/20131216111917/https://launchpad.net/~ondrej/+archive/php5-oldstable

可以看到當時PPA裡有php5的raring包。這是您的其他伺服器已安裝的內容。如果你今天看一下,那個包裹不在那裡。 Ubuntu 不會刪除已經安裝的軟體套件;所以你的其他伺服器仍然會有它。

從 PPA 中刪除該軟體包的原因可能是因為 Ubuntu 13.04 已經失去了支援。它在一月份停止接收更新。仍在使用 13.04 的任何人都應該升級到 13.10。

相關內容