如何在 CentOS 上使用 yum 将 PHP 5.1 升级到 PHP 5.3

qod*_*nja 6 php centos yum

使用 Yum/CentOS。

问题是 php 5.1 已经安装并运行,所以

百胜更新php

不工作!

我环顾网络寻找解决方案,但他们说要执行上述操作=/

Ste*_*ski 8

你会想要的yum install php53。不幸的是,您需要先删除php(即 php 5.1,见下文)。

php53 在CentOS 5.6 及以上版本的CentOS 中可用。它在 CentOS 5.5 及更早版本中不可用,除非您通过第三方存储库。这就是为什么 Serverfault 上的许多答案都告诉您使用第三方存储库的原因——这不再是必要的了。

请注意,php53 有许多依赖项,因此您应该考虑将 CentOS 更新到最新的 CentOS 5.x 分支作为此次升级的一部分(在撰写本文时为 CentOS 5.6)。这是 PHP 的一次重大升级,RedHat 强行通过,因为它们在 RHEL5.5 时已经落后于时代。

注意包是如何命名的php53,而phpphp 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.
Run Code Online (Sandbox Code Playgroud)