查看系统版本

cat  /etc/redhat-release  
lsb_release -a 

yum install -y httpd  
systemctl restart httpd
systemctl enable httpd
systemctl status httpd

firewall-cmd --list-ports 
firewall-cmd --add-port=80/tcp --permanent
firewall-cmd --add-port=8000-9999/tcp --permanent  # firewall-cmd --add-port=10000-12000/tcp --permanent
systemctl restart firewalld

查看php -m安装了哪些模块

卸载老版本

yum remove -y php php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-mbstring php-bcmath php-mhash
yum remove -y php-xml php-xmlrpc
yum remove -y php-soap

php -v
yum -y install epel-release  安装epel-release 无需

yum安装php7===========================
http://blog.csdn.net/dxywx/article/details/50609137
[centos6安装] rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
centos7新的
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 -y yum-plugin-replace
yum replace php-common --replace-with=php72w-common
yum replace php-common --replace-with=php70w-common
升级到7.1 yum replace php-common --replace-with=php71w-common
7.0升级7.1 yum replace php70w-common --replace-with=php71w-common
yum replace php71w-common --replace-with=php72w-common

手工安装PHP7

yum install php72w -y
#yum install php70w
#yum install php71w

#安装插件
yum install -y php72w-pdo_mysql  php72w-mbstring php72w-cli php72w-gd 
yum install -y php72w-mysql  php72w-zip 
yum install php72w-opcache
yum install php70w-pecl-redis

查看php 版本

php -v

错误处理,no such file 是缺少PHP命令行组件,需要:

yum install php71w-cli
yum install php70w-cli
yum install php72w-cli

yum remove -y php72w-openssl

php70w-common包含的插件:

php-api, php-bz2, php-calendar, php-ctype, php-curl, php-date, php-exif, php-fileinfo, php-filter, php-ftp, php-gettext, php-gmp, php-hash, php-iconv, php-json, php-libxml, php-openssl, php-pcre, php-pecl-Fileinfo, php-pecl-phar, php-pecl-zip, php-reflection, php-session, php-shmop, php-simplexml, php-sockets, php-spl, php-tokenizer, php-zend-abi, php-zip, php-zlib
删除不需要的包
yum remove -y 
php72w-soap
 php72w-pdo_sqlite
 php72w-xml
php72w-openssl

============================================
单包升级:

yum replace php --replace-with=php71w
yum replace php-cli --replace-with=php70w-cli
yum replace php70w-cli --replace-with=php71w-cli
mysql
yum replace php70w-mbstring --replace-with=php71w-mbstring

php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-mbstring php-bcmath php-mhash
yum remove -y php-xml php-xmlrpc
yum remove -y php-soap

ERROR 一定要关闭SELinux 默认是开启状态,关闭即可 setenforce 0 临时

修改/etc/selinux/config 文件
将SELINUX=enforcing改为SELINUX=disabled