![如何在 CentOS 上使用 yum 将 PHP 5.1 升级到 PHP 5.3](https://linux22.com/image/557009/%E5%A6%82%E4%BD%95%E5%9C%A8%20CentOS%20%E4%B8%8A%E4%BD%BF%E7%94%A8%20yum%20%E5%B0%86%20PHP%205.1%20%E5%8D%87%E7%BA%A7%E5%88%B0%20PHP%205.3.png)
使用 Yum/CentOS。
问题是 php 5.1 已经安装并正在运行,因此
yum 更新 php
不工作!
我在网上寻找解决方案,但他们说要执行上述操作 =/
答案1
你会想要yum install php53
。不幸的是,你需要先删除php
(即 php 5.1,见下文)。
php53 在 CentOS 中可用CentOS 5.6 及以上版本。除非您通过第三方存储库,否则它在 CentOS 5.5 及更早版本中不可用。这就是为什么 Serverfault 上的许多答案都告诉您使用第三方存储库——这不再是必要的。
请注意,php53 有许多依赖项,因此您应该考虑将 CentOS 更新到最新的 CentOS 5.x 分支作为此次升级的一部分(撰写本文时为 CentOS 5.6)。这是 PHP 的一次重大升级,RedHat 强制通过了该升级,因为他们在 RHEL5.5 时已经远远落后于时代。
请注意包的命名方式php53
,而php
php 5.1 是:
$ yum info php53
Available Packages
Name : php53
Arch : x86_64
Version : 5.3.3
Release : 1.el5_6.1
Size : 1.3 M
Repo : updates
Summary : PHP scripting language for creating dynamic web sites
URL : http://www.php.net/
License : PHP and LGPLv2 and LGPLv2+
Description: PHP is an HTML-embedded scripting language. PHP attempts to make it
: easy for developers to write dynamically generated webpages. PHP also
: offers built-in database integration for several commercial and
: non-commercial database management systems, so writing a
: database-enabled webpage with PHP is fairly simple. The most common
: use of PHP coding is probably as a replacement for CGI scripts.
:
: The php package contains the module which adds support for the PHP
: language to Apache HTTP Server.
$ yum info php
Available Packages
Name : php
Arch : x86_64
Version : 5.1.6
Release : 27.el5_5.3
Size : 2.3 M
Repo : base
Summary : The PHP HTML-embedded scripting language. (PHP: Hypertext Preprocessor)
URL : http://www.php.net/
License : The PHP License v3.01
Description: PHP is an HTML-embedded scripting language. PHP attempts to make it
: easy for developers to write dynamically generated webpages. PHP also
: offers built-in database integration for several commercial and
: non-commercial database management systems, so writing a
: database-enabled webpage with PHP is fairly simple. The most common
: use of PHP coding is probably as a replacement for CGI scripts.
:
: The php package contains the module which adds support for the PHP
: language to Apache HTTP Server.
答案2
您需要任何其他 repo 来升级 php,因为 php 5.3 尚未包含在 CentOS Base Repo 中。您可以使用 atomic repo,它对我来说运行完美,
wget -q -O - http://www.atomicorp.com/installers/atomic | sh
yum upgrade php
yum -y remove atomic-release*
这将安装 atomic repo,升级 php 然后删除 atomic-repo(以确保任何未来的系统更新都不会从 atomic 安装任何附加包)。