centos7 安装php7

ε祈祈猫儿з 提交于 2020-12-19 07:32:56

一、首先查看是否有老版本

yum list installed | grep php

二、如果安装的有

yum remove php.x8664 php-cli.x8664 php-common.x8664 php-gd.x8664 php-ldap.x8664 php-mbstring.x8664 php-mcrypt.x8664 php-mysql.x8664 php-pdo.x86_64

三、安装epel-release

通过命令:

rpm -vih http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm

(这个大家可以访问http://dl.fedoraproject.org/pub/epel/7/x86_64/e/ 目录,下载epel-release-XXX.noarch.rpm的最新版本)

成功安装。

四、安装PHP7

终端再次运行如下命令:

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

成功获取PHP7的yum源,然后再执行:

yum install php70w

五、安装 php-mysql php-fpm 扩展

yum install php70-php-mysql php70-php-fpm

六、如果执行报错:

Resolving Dependencies --> Running transaction check ---> Package php70w.x86_64 0:7.0.20-1.w6 will be installed --> Processing Dependency: php70w-common(x86-64) = 7.0.20-1.w6 for package: php70w-7.0.20-1.w6.x86_64 --> Processing Dependency: php70w-cli(x86-64) = 7.0.20-1.w6 for package: php70w-7.0.20-1.w6.x86_64 --> Processing Dependency: php70w-cli = 7.0.20-1.w6 for package: php70w-7.0.20-1.w6.x86_64 --> Processing Dependency: httpd-mmn = 20051115 for package: php70w-7.0.20-1.w6.x86_64 --> Running transaction check ---> Package php70w.x86_64 0:7.0.20-1.w6 will be installed --> Processing Dependency: httpd-mmn = 20051115 for package: php70w-7.0.20-1.w6.x86_64 ---> Package php70w-cli.x86_64 0:7.0.20-1.w6 will be installed ---> Package php70w-common.x86_64 0:7.0.20-1.w6 will be installed --> Processing Dependency: libgmp.so.3()(64bit) for package: php70w-common-7.0.20-1.w6.x86_64 --> Finished Dependency Resolution Error: Package: php70w-common-7.0.20-1.w6.x86_64 (webtatic) Requires: libgmp.so.3()(64bit) Error: Package: php70w-7.0.20-1.w6.x86_64 (webtatic) Requires: httpd-mmn = 20051115 Installed: httpd-2.4.6-45.el7.centos.4.x86_64 (@updates) httpd-mmn = 20120211 httpd-mmn = 20120211x8664 httpd-mmn = 20120211-x86-64 Available: httpd-2.4.6-45.el7.centos.x86_64 (base) httpd-mmn = 20120211x8664 httpd-mmn = 20120211-x86-64 httpd-mmn = 20120211 You could try using --skip-broken to work around the problem You could try running: rpm -Va --nofiles --nodigest

执行yum clean all 清除缓存后,

再次执行

yum install php70w

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!