linux:安装php7.x

参考:链接

更新yum源

CentOS/RHEL 7.x:

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

CentOS/RHEL 6.x:

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm

安装php7.x

yum install php70w-fpm php70w php70w-mysql

检测

查看版本

php -v

页面测试

1、默认的Apache站点目录:/var/www/html/

创建一个index.php文件

检测

2、验证 LNMP 环境是否搭建成功

a、创建测试文件

echo "<?php phpinfo(); ?>" >> /usr/share/nginx/html/index.php

b、重启 Nginx 服务

systemctl restart nginx

c、测试

报错

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  //清除缓存

再次执行!

设置开机自启动

chkconfig --add php-fpm
chkconfig php-fpm on
posted @ 2020-06-24 12:20  PamShao  阅读(410)  评论(0编辑  收藏  举报