如何在 Centos 7 上将 PHP 从 5.4.16 升级到 >= PHP 5.6.5 / PHP 7?

如何在 Centos 7 上将 PHP 从 5.4.16 升级到 >= PHP 5.6.5 / PHP 7?

我使用的是 centos 7,它自带 php 5.4.16。现在我必须安装 moodle moodle 3.2,它至少需要 PHP 5.6.5。

我尝试从 remi 和 IUS 存储库安装 php,但没有成功。我得到的只是错误:与以前的安装冲突。

如果我安装任何其他版本的 php phpmyadmin 将无法工作。 (我在开发服务器上尝试过,但没有成功)

顺便说一句,我尝试了很多谷歌搜索......但最终没有找到有效的解决方案。所以我必须创建这个。

我如何实现moodle和phpmyadmin都在我的服务器上工作?

非常感谢任何帮助。

请检查下面

[root@intranet ~]# yum -y install php56u php56u-opcache php56u-xml php56u-mcrypt php56u-gd php56u-devel php56u-mysql php56u-intl php56u-mbstring php56u-bcmath
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.ehost.vn
 * epel: mirror.lzu.edu.cn
 * extras: centos.excellmedia.net
 * ius: mirror.amsiohosting.net
 * remi-safe: mirror.veriteknik.net.tr
 * updates: mirror.tadu.vn
 * webtatic: us-east.repo.webtatic.com
Resolving Dependencies
--> Running transaction check
---> Package php56u.x86_64 0:5.6.29-1.ius.centos7 will be installed
--> Processing Dependency: php56u-cli(x86-64) = 5.6.29-1.ius.centos7 for package: php56u-5.6.29-1.ius.centos7.x86_64
--> Processing Dependency: php56u-common(x86-64) = 5.6.29-1.ius.centos7 for package: php56u-5.6.29-1.ius.centos7.x86_64
---> Package php56u-bcmath.x86_64 0:5.6.29-1.ius.centos7 will be installed
---> Package php56u-devel.x86_64 0:5.6.29-1.ius.centos7 will be installed
--> Processing Dependency: php56u-pecl-jsonc-devel(x86-64) for package: php56u-devel-5.6.29-1.ius.centos7.x86_64
---> Package php56u-gd.x86_64 0:5.6.29-1.ius.centos7 will be installed
---> Package php56u-intl.x86_64 0:5.6.29-1.ius.centos7 will be installed
---> Package php56u-mbstring.x86_64 0:5.6.29-1.ius.centos7 will be installed
---> Package php56u-mcrypt.x86_64 0:5.6.29-1.ius.centos7 will be installed
---> Package php56u-mysqlnd.x86_64 0:5.6.29-1.ius.centos7 will be installed
--> Processing Dependency: php56u-pdo(x86-64) = 5.6.29-1.ius.centos7 for package: php56u-mysqlnd-5.6.29-1.ius.centos7.x86_64
---> Package php56u-opcache.x86_64 0:5.6.29-1.ius.centos7 will be installed
---> Package php56u-xml.x86_64 0:5.6.29-1.ius.centos7 will be installed
--> Running transaction check
---> Package php56u-cli.x86_64 0:5.6.29-1.ius.centos7 will be installed
---> Package php56u-common.x86_64 0:5.6.29-1.ius.centos7 will be installed
--> Processing Dependency: php56u-pecl-jsonc(x86-64) for package: php56u-common-5.6.29-1.ius.centos7.x86_64
---> Package php56u-pdo.x86_64 0:5.6.29-1.ius.centos7 will be installed
---> Package php56u-pecl-jsonc-devel.x86_64 0:1.3.10-2.ius.centos7 will be installed
--> Running transaction check
---> Package php56u-pecl-jsonc.x86_64 0:1.3.10-2.ius.centos7 will be installed
--> Processing Dependency: php56u-pear for package: php56u-pecl-jsonc-1.3.10-2.ius.centos7.x86_64
--> Processing Dependency: php56u-pear for package: php56u-pecl-jsonc-1.3.10-2.ius.centos7.x86_64
--> Running transaction check
---> Package php56u-pear.noarch 1:1.10.1-4.ius.centos7 will be installed
--> Processing Dependency: php56u-posix for package: 1:php56u-pear-1.10.1-4.ius.centos7.noarch
--> Running transaction check
---> Package php56u-process.x86_64 0:5.6.29-1.ius.centos7 will be installed
--> Processing Conflict: php-mysql-5.4.16-42.el7.x86_64 conflicts php-mysqlnd
--> Processing Conflict: php56u-process-5.6.29-1.ius.centos7.x86_64 conflicts php-process < 5.6
--> Processing Conflict: php56u-gd-5.6.29-1.ius.centos7.x86_64 conflicts php-gd < 5.6
--> Processing Conflict: php56u-bcmath-5.6.29-1.ius.centos7.x86_64 conflicts php-bcmath < 5.6
--> Processing Conflict: php56u-common-5.6.29-1.ius.centos7.x86_64 conflicts php-common < 5.6
--> Processing Conflict: php56u-cli-5.6.29-1.ius.centos7.x86_64 conflicts php-cli < 5.6
--> Processing Conflict: php56u-xml-5.6.29-1.ius.centos7.x86_64 conflicts php-xml < 5.6
--> Processing Conflict: php56u-5.6.29-1.ius.centos7.x86_64 conflicts php < 5.6
--> Processing Conflict: php56u-pdo-5.6.29-1.ius.centos7.x86_64 conflicts php-pdo < 5.6
--> Processing Conflict: php56u-mysqlnd-5.6.29-1.ius.centos7.x86_64 conflicts php-mysql < 5.6
--> Processing Conflict: php56u-mbstring-5.6.29-1.ius.centos7.x86_64 conflicts php-mbstring < 5.6
--> Finished Dependency Resolution
Error: php56u-bcmath conflicts with php-bcmath-5.4.16-42.el7.x86_64
Error: php56u-mbstring conflicts with php-mbstring-5.4.16-42.el7.x86_64
Error: php56u-gd conflicts with php-gd-5.4.16-42.el7.x86_64
Error: php56u conflicts with php-5.4.16-42.el7.x86_64
Error: php-mysql conflicts with php56u-mysqlnd-5.6.29-1.ius.centos7.x86_64
Error: php56u-mysqlnd conflicts with php-mysql-5.4.16-42.el7.x86_64
Error: php56u-process conflicts with php-process-5.4.16-42.el7.x86_64
Error: php56u-xml conflicts with php-xml-5.4.16-42.el7.x86_64
Error: php56u-pdo conflicts with php-pdo-5.4.16-42.el7.x86_64
Error: php56u-cli conflicts with php-cli-5.4.16-42.el7.x86_64
Error: php56u-common conflicts with php-common-5.4.16-42.el7.x86_64
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

答案1

有一个简短的指南曼月乐使用指南。简而言之,您可以尝试以下操作:

yum install yum-plugin-replace
yum replace php --replace-with php56u

答案2

步骤1

CentOS/RHEL 7.x:

rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

CentOS/RHEL 6.x:

rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm

第2步

现在您可以通过执行以下操作来安装带有操作码缓存的 PHP 5.6:

yum install php56w php56w-opcache

步骤:3

您可以通过以下方式升级 PHP:

yum install yum-plugin-replace

yum replace --enablerepo=webtatic-testing php-common --replace-with=php56w-common

相关内容