如何在CentOS 5.x中将PHP5.1升级到更高版本

如何在CentOS 5.x中将PHP5.1升级到更高版本,php,linux,centos,Php,Linux,Centos,我刚从databasemart.com买了一台新主机,但问题是我安装了wordpress,VPS上的PHP版本是5.1,但wordpress至少需要5.2.4。我花了整整6个小时来解决这个问题,但没有任何帮助。有什么想法吗 编辑:我就是不明白。。这是我在ssh中看到的: php -v PHP 5.3.3 (cli) (built: Jun 9 2016 18:22:38) Copyright (c) 1997-2010 The PHP Group 但另一方面。。这是我打开网站时看到的: 您的

我刚从databasemart.com买了一台新主机,但问题是我安装了wordpress,VPS上的PHP版本是5.1,但wordpress至少需要5.2.4。我花了整整6个小时来解决这个问题,但没有任何帮助。有什么想法吗

编辑:我就是不明白。。这是我在ssh中看到的:

php -v
PHP 5.3.3 (cli) (built: Jun  9 2016 18:22:38)
Copyright (c) 1997-2010 The PHP Group
但另一方面。。这是我打开网站时看到的:

您的服务器正在运行PHP版本5.1.6,但WordPress 4.1.5需要 至少5.2.4

编辑2:我尝试安装mirror 5.4,结果如下:

yum install  php-5.4.16-36.el7_1.x86_64.rpm

Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: centos.host-engine.com
 * epel: fedora-epel.mirror.lstn.net
 * extras: yum.tamu.edu
 * updates: mirror.team-cymru.org
Setting up Install Process
Examining php-5.4.16-36.el7_1.x86_64.rpm: php-5.4.16-36.el7_1.x86_64
Marking php-5.4.16-36.el7_1.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package php.x86_64 0:5.4.16-36.el7_1 set to be updated
--> Processing Dependency: httpd-mmn = 20120211x8664 for package: php
--> Processing Dependency: php-common(x86-64) = 5.4.16-36.el7_1 for package: php
--> Processing Dependency: php-cli(x86-64) = 5.4.16-36.el7_1 for package: php
--> Processing Dependency: libcrypto.so.10(libcrypto.so.10)(64bit) for package: php
--> Processing Dependency: libcrypto.so.10(OPENSSL_1.0.1)(64bit) for package: php
--> Processing Dependency: libc.so.6(GLIBC_2.11)(64bit) for package: php
--> Processing Dependency: libc.so.6(GLIBC_2.14)(64bit) for package: php
--> Processing Dependency: libc.so.6(GLIBC_2.15)(64bit) for package: php
--> Processing Dependency: libc.so.6(GLIBC_2.7)(64bit) for package: php
--> Processing Dependency: libc.so.6(GLIBC_2.8)(64bit) for package: php
--> Processing Dependency: libssl.so.10(libssl.so.10)(64bit) for package: php
--> Processing Dependency: libxml2.so.2(LIBXML2_2.4.30)(64bit) for package: php
--> Processing Dependency: libxml2.so.2(LIBXML2_2.5.2)(64bit) for package: php
--> Processing Dependency: libxml2.so.2(LIBXML2_2.6.0)(64bit) for package: php
--> Processing Dependency: libxml2.so.2(LIBXML2_2.6.11)(64bit) for package: php
--> Processing Dependency: libxml2.so.2(LIBXML2_2.6.5)(64bit) for package: php
--> Processing Dependency: libxml2.so.2(LIBXML2_2.9.0)(64bit) for package: php
--> Processing Dependency: libcrypto.so.10()(64bit) for package: php
--> Processing Dependency: libgmp.so.10()(64bit) for package: php
--> Processing Dependency: libpcre.so.1()(64bit) for package: php
--> Processing Dependency: libssl.so.10()(64bit) for package: php
--> Running transaction check
---> Package openssl101e.x86_64 0:1.0.1e-8.el5 set to be updated
---> Package php.x86_64 0:5.4.16-36.el7_1 set to be updated
--> Processing Dependency: httpd-mmn = 20120211x8664 for package: php
--> Processing Dependency: php-common(x86-64) = 5.4.16-36.el7_1 for package: php
--> Processing Dependency: php-cli(x86-64) = 5.4.16-36.el7_1 for package: php
--> Processing Dependency: libc.so.6(GLIBC_2.11)(64bit) for package: php
--> Processing Dependency: libc.so.6(GLIBC_2.14)(64bit) for package: php
--> Processing Dependency: libc.so.6(GLIBC_2.15)(64bit) for package: php
--> Processing Dependency: libc.so.6(GLIBC_2.7)(64bit) for package: php
--> Processing Dependency: libc.so.6(GLIBC_2.8)(64bit) for package: php
--> Processing Dependency: libxml2.so.2(LIBXML2_2.4.30)(64bit) for package: php
--> Processing Dependency: libxml2.so.2(LIBXML2_2.5.2)(64bit) for package: php
--> Processing Dependency: libxml2.so.2(LIBXML2_2.6.0)(64bit) for package: php
--> Processing Dependency: libxml2.so.2(LIBXML2_2.6.11)(64bit) for package: php
--> Processing Dependency: libxml2.so.2(LIBXML2_2.6.5)(64bit) for package: php
--> Processing Dependency: libxml2.so.2(LIBXML2_2.9.0)(64bit) for package: php
--> Processing Dependency: libgmp.so.10()(64bit) for package: php
--> Processing Dependency: libpcre.so.1()(64bit) for package: php
--> Finished Dependency Resolution
php-5.4.16-36.el7_1.x86_64 from /php-5.4.16-36.el7_1.x86_64 has depsolving problems
  --> Missing Dependency: libxml2.so.2(LIBXML2_2.9.0)(64bit) is needed by package php-5.4.16-36.el7_1.x86_64 (/php-5.4.16-36.el7_1.x86_64)
php-5.4.16-36.el7_1.x86_64 from /php-5.4.16-36.el7_1.x86_64 has depsolving problems
  --> Missing Dependency: libxml2.so.2(LIBXML2_2.6.5)(64bit) is needed by package php-5.4.16-36.el7_1.x86_64 (/php-5.4.16-36.el7_1.x86_64)
php-5.4.16-36.el7_1.x86_64 from /php-5.4.16-36.el7_1.x86_64 has depsolving problems
  --> Missing Dependency: libxml2.so.2(LIBXML2_2.6.0)(64bit) is needed by package php-5.4.16-36.el7_1.x86_64 (/php-5.4.16-36.el7_1.x86_64)
php-5.4.16-36.el7_1.x86_64 from /php-5.4.16-36.el7_1.x86_64 has depsolving problems
  --> Missing Dependency: libc.so.6(GLIBC_2.14)(64bit) is needed by package php-5.4.16-36.el7_1.x86_64 (/php-5.4.16-36.el7_1.x86_64)
php-5.4.16-36.el7_1.x86_64 from /php-5.4.16-36.el7_1.x86_64 has depsolving problems
  --> Missing Dependency: libxml2.so.2(LIBXML2_2.5.2)(64bit) is needed by package php-5.4.16-36.el7_1.x86_64 (/php-5.4.16-36.el7_1.x86_64)
php-5.4.16-36.el7_1.x86_64 from /php-5.4.16-36.el7_1.x86_64 has depsolving problems
  --> Missing Dependency: libxml2.so.2(LIBXML2_2.4.30)(64bit) is needed by package php-5.4.16-36.el7_1.x86_64 (/php-5.4.16-36.el7_1.x86_64)
php-5.4.16-36.el7_1.x86_64 from /php-5.4.16-36.el7_1.x86_64 has depsolving problems
  --> Missing Dependency: libxml2.so.2(LIBXML2_2.6.11)(64bit) is needed by package php-5.4.16-36.el7_1.x86_64 (/php-5.4.16-36.el7_1.x86_64)
php-5.4.16-36.el7_1.x86_64 from /php-5.4.16-36.el7_1.x86_64 has depsolving problems
  --> Missing Dependency: libpcre.so.1()(64bit) is needed by package php-5.4.16-36.el7_1.x86_64 (/php-5.4.16-36.el7_1.x86_64)
php-5.4.16-36.el7_1.x86_64 from /php-5.4.16-36.el7_1.x86_64 has depsolving problems
  --> Missing Dependency: libc.so.6(GLIBC_2.8)(64bit) is needed by package php-5.4.16-36.el7_1.x86_64 (/php-5.4.16-36.el7_1.x86_64)
php-5.4.16-36.el7_1.x86_64 from /php-5.4.16-36.el7_1.x86_64 has depsolving problems
  --> Missing Dependency: php-cli(x86-64) = 5.4.16-36.el7_1 is needed by package php-5.4.16-36.el7_1.x86_64 (/php-5.4.16-36.el7_1.x86_64)
php-5.4.16-36.el7_1.x86_64 from /php-5.4.16-36.el7_1.x86_64 has depsolving problems
  --> Missing Dependency: libc.so.6(GLIBC_2.7)(64bit) is needed by package php-5.4.16-36.el7_1.x86_64 (/php-5.4.16-36.el7_1.x86_64)
php-5.4.16-36.el7_1.x86_64 from /php-5.4.16-36.el7_1.x86_64 has depsolving problems
  --> Missing Dependency: php-common(x86-64) = 5.4.16-36.el7_1 is needed by package php-5.4.16-36.el7_1.x86_64 (/php-5.4.16-36.el7_1.x86_64)
php-5.4.16-36.el7_1.x86_64 from /php-5.4.16-36.el7_1.x86_64 has depsolving problems
  --> Missing Dependency: httpd-mmn = 20120211x8664 is needed by package php-5.4.16-36.el7_1.x86_64 (/php-5.4.16-36.el7_1.x86_64)
php-5.4.16-36.el7_1.x86_64 from /php-5.4.16-36.el7_1.x86_64 has depsolving problems
  --> Missing Dependency: libc.so.6(GLIBC_2.11)(64bit) is needed by package php-5.4.16-36.el7_1.x86_64 (/php-5.4.16-36.el7_1.x86_64)
php-5.4.16-36.el7_1.x86_64 from /php-5.4.16-36.el7_1.x86_64 has depsolving problems
  --> Missing Dependency: libgmp.so.10()(64bit) is needed by package php-5.4.16-36.el7_1.x86_64 (/php-5.4.16-36.el7_1.x86_64)
php-5.4.16-36.el7_1.x86_64 from /php-5.4.16-36.el7_1.x86_64 has depsolving problems
  --> Missing Dependency: libc.so.6(GLIBC_2.15)(64bit) is needed by package php-5.4.16-36.el7_1.x86_64 (/php-5.4.16-36.el7_1.x86_64)
Error: Missing Dependency: libxml2.so.2(LIBXML2_2.6.0)(64bit) is needed by package php-5.4.16-36.el7_1.x86_64 (/php-5.4.16-36.el7_1.x86_64)
Error: Missing Dependency: libxml2.so.2(LIBXML2_2.5.2)(64bit) is needed by package php-5.4.16-36.el7_1.x86_64 (/php-5.4.16-36.el7_1.x86_64)
Error: Missing Dependency: libgmp.so.10()(64bit) is needed by package php-5.4.16-36.el7_1.x86_64 (/php-5.4.16-36.el7_1.x86_64)
Error: Missing Dependency: libxml2.so.2(LIBXML2_2.6.11)(64bit) is needed by package php-5.4.16-36.el7_1.x86_64 (/php-5.4.16-36.el7_1.x86_64)
Error: Missing Dependency: libc.so.6(GLIBC_2.15)(64bit) is needed by package php-5.4.16-36.el7_1.x86_64 (/php-5.4.16-36.el7_1.x86_64)
Error: Missing Dependency: libc.so.6(GLIBC_2.8)(64bit) is needed by package php-5.4.16-36.el7_1.x86_64 (/php-5.4.16-36.el7_1.x86_64)
Error: Missing Dependency: php-common(x86-64) = 5.4.16-36.el7_1 is needed by package php-5.4.16-36.el7_1.x86_64 (/php-5.4.16-36.el7_1.x86_64)
Error: Missing Dependency: libpcre.so.1()(64bit) is needed by package php-5.4.16-36.el7_1.x86_64 (/php-5.4.16-36.el7_1.x86_64)
Error: Missing Dependency: libxml2.so.2(LIBXML2_2.4.30)(64bit) is needed by package php-5.4.16-36.el7_1.x86_64 (/php-5.4.16-36.el7_1.x86_64)
Error: Missing Dependency: php-cli(x86-64) = 5.4.16-36.el7_1 is needed by package php-5.4.16-36.el7_1.x86_64 (/php-5.4.16-36.el7_1.x86_64)
Error: Missing Dependency: httpd-mmn = 20120211x8664 is needed by package php-5.4.16-36.el7_1.x86_64 (/php-5.4.16-36.el7_1.x86_64)
Error: Missing Dependency: libxml2.so.2(LIBXML2_2.9.0)(64bit) is needed by package php-5.4.16-36.el7_1.x86_64 (/php-5.4.16-36.el7_1.x86_64)
Error: Missing Dependency: libc.so.6(GLIBC_2.14)(64bit) is needed by package php-5.4.16-36.el7_1.x86_64 (/php-5.4.16-36.el7_1.x86_64)
Error: Missing Dependency: libxml2.so.2(LIBXML2_2.6.5)(64bit) is needed by package php-5.4.16-36.el7_1.x86_64 (/php-5.4.16-36.el7_1.x86_64)
Error: Missing Dependency: libc.so.6(GLIBC_2.11)(64bit) is needed by package php-5.4.16-36.el7_1.x86_64 (/php-5.4.16-36.el7_1.x86_64)
Error: Missing Dependency: libc.so.6(GLIBC_2.7)(64bit) is needed by package php-5.4.16-36.el7_1.x86_64 (/php-5.4.16-36.el7_1.x86_64)
 You could try using --skip-broken to work around the problem
 You could try running: package-cleanup --problems
                        package-cleanup --dupes
                        rpm -Va --nofiles --nodigest
The program package-cleanup is found in the yum-utils package.

我觉得很尴尬。我的主持人告诉我我有CentOS 7.x,但我想确认一下,当我检查它时,它是
CentOS-release-5-11.el5.CentOS

我遵循了本教程:

另外,安装软件包后,不要忘记重新启动httpd服务
服务httpd restart


问题解决了。非常感谢你们的帮助。没有你我不可能做到这一点

我尝试了以下命令:“yum-upgrade-php”,但不起作用,我还尝试了rpm命令。我甚至尝试使用wget./configue安装php5包,但当我执行“php-v”时,它不会显示,您必须显示您所尝试的内容。我已经检查了CentOS 7 Repo,他们的PHP版本是5.4.16,等等。我会立即尝试这个方法。您应该首先尝试Yum Update-Yum-y Update phpTry一个包含phpinfo函数的页面,访问它wget或浏览器,查找ini文件的位置,这将有助于您了解哪个版本在哪里。