CentOS7采用yum方式安装PHP7

查看系统版本命令

[root@VM_176_162_centos ~]# cat /etc/centos-release
CentOS Linux release 7.3.1611 (Core)

1.若之前安装过其他版本PHP,先删除

# yum remove php*

2.rpm安装PHP7相应的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://mirror.webtatic.com/yum/el6/latest.rpm

3.yum安装PHP7

# yum install php70w

4.安装其他插件(选装)

这一步如果闲麻烦的话直接在上一步执行下面这条命令即可(提示有冲突的话按照提示过滤冲突即可)

# yum install php70w* //意为安装全部插件

php70w
php70w-opcache
php70w-bcmath 
php70w-cli
php70w-common
php70w-dba 
php70w-devel 
php70w-embedded
php70w-enchant 
php70w-fpm 
php70w-gd 
php70w-imap 
php70w-interbase
php70w-intl 
php70w-ldap 
php70w-mbstring 
php70w-mcrypt 
php70w-mysql
php70w-mysqlnd
php70w-odbc
php70w-opcache
php70w-pdo 
php70w-pdo_dblib 
php70w-pear 
php70w-pecl-apcu 
php70w-pecl-imagick 
php70w-pecl-xdebug 
php70w-pgsql 
php70w-phpdbg 
php70w-process 
php70w-pspell 
php70w-recode 
php70w-snmp 
php70w-soap 
php70w-tidy 
php70w-xml 
php70w-xmlrpc
5. 安装完毕,测试是否安装成功

# php -v

6.要运行PHP网页,要启动php-fpm解释器

# service php-fpm start

    原文作者:别瞄我
    原文地址: https://www.jianshu.com/p/8d54a401ec06
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞