查看当前安装的PHP包
[root@node1 ~]# yum list installed | grep php
php56w.x86_64 5.6.-.w7 @webtatic
php56w-cli.x86_64 5.6.-.w7 @webtatic
php56w-common.x86_64 5.6.-.w7 @webtatic
php56w-gd.x86_64 5.6.-.w7 @webtatic
php56w-ldap.x86_64 5.6.-.w7 @webtatic
php56w-mbstring.x86_64 5.6.-.w7 @webtatic
php56w-mcrypt.x86_64 5.6.-.w7 @webtatic
php56w-mysql.x86_64 5.6.-.w7 @webtatic
php56w-pdo.x86_64 5.6.-.w7
如果有安装包,先删除
yum remove php.4 php56*
配置安装源
[root@node1 ~]# rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
Retrieving https://mirror.webtatic.com/yum/el7/epel-release.rpm
Preparing... ################################# [%]
package epel-release--.noarch (which is newer than epel-release--.noarch) is already installed [root@node1 ~]# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
Retrieving https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
Preparing... ################################# [%]
package webtatic-release--.noarch is already installed
安装 php 5.5
yum -y install php55w.x86_64 php55w-cli.x86_64 php55w-common.x86_64 php55w-gd.x86_64 php55w-ldap.x86_64 php55w-mbstring.x86_64 php55w-mcrypt.x86_64 php55w-mysql.x86_64 php55w-pdo.x86_64
安装 php 5.6
[root@node1 ~]# yum -y install php56w.x86_64 php56w-cli.x86_64 php56w-common.x86_64 php56w-gd.x86_64 php56w-ldap.x86_64 php56w-mbstring.x86_64 php56w-mcrypt.x86_64 php56w-mysql.x86_64 php56w-pdo.x86_64
安装 php 7.0
yum install -y php70w.x86_64 php70w-cli.x86_64 php70w-common.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mcrypt.x86_64 php70w-mysql.x86_64 php70w-pdo.x86_64
安装 php fpm
[root@node1 ~]# yum -y install php55w-fpm
[root@node1 ~]# yum -y install php56w-fpm
[root@node1 ~]# yum -y install php70w-fpm
查看版本
[root@node1 ~]# php -v
PHP 5.6. (cli) (built: Jul ::)
Copyright (c) - The PHP Group
Zend Engine v2.6.0, Copyright (c) - Zend Technologies
启动php
[root@node1 ~]# service php-fpm start
关闭
[root@node1 ~]# service php-fpm stop
重启
[root@node1 ~]# service php-fpm restart
查看进程
[root@node1 ~]# ps -ef | grep php-fpm
查看端口
[root@node1 ~]# lsof -i :
配置文件在
[root@node1 ~]# vim /etc/php.ini
配置nginx 支持PHP 程序请求访问