centos 7怎么安装php

发布时间:2022-05-25 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了centos 7怎么安装php脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。

centos7安装php的方法:1、安装php yum;2、通过“yum -y remove php*”清理旧php;3、安装php精简拓展;4、设置php-FPM开机自启即可。

centos 7怎么安装php

本文操作环境:centos7系统、php7.2版、DELL G3

centos7怎么安装php?

Centos7安装php7.2

建议方法

# 安装EPEL yum存储库
 yum install ePEl-release -y
 # 安装Remi存储库
 rpm -Uvh http://rpms.famillecollet.COM/Enterprise/remi-release-7.rpm
 # 安装 PHP 7.3 
 yum --enablerepo=remi-php73 install php
 # 安装 php 7.2 
 yum --enablerepo=remi-php72 install php
 # 安装 PHP 7.1 
 yum --enablerepo=remi-php71 install php

安装php yum源

# 方法一:
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
# 方法二:
yum install epel-release -y
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

清理 旧php

yum -y remove php*

查看可以安装的phP版

yum list php*

安装php精简拓展

yum -y install php72w php72w-cli php72w-fpm php72w-common php72w-devel 
# 也可以安装 豪华版拓展
yum -y install php72w php72w-cli php72w-fpm php72w-common php72w-devel php72w-embedded php72w-gd php72w-mbstring php72w-MySQLnd php72w-Opcache php72w-pdo php72w-XMl

php-fpm开机自启

Systemctl enable php-fpm

这种安装方法 可能会出现 yum info php与 php -v 两条命令 显示的php版本不同

推荐学习:《PHP视频教程》

以上就是centos 7怎么安装php的详细内容,更多请关注脚本宝典其它相关文章

脚本宝典总结

以上是脚本宝典为你收集整理的centos 7怎么安装php全部内容,希望文章能够帮你解决centos 7怎么安装php所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: