安装PHP服务
配置php仓库 方法一:
(1) 配置PHP仓库
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 remove php-mysql-5.4 php php-fpm php-common
#配置第三方源 (不配置 直接 yum 也可以)
[root@nginx ~]# vim /etc/yum.repos.d/php.repo
[php-webtatic]
name = PHP Repository
baseurl = http://us-east.repo.webtatic.com/yum/el7/x86_64/
gpgcheck = 0
(2) 安装PHP服务
yum -y install php71w php71w-cli php71w-common php71w-devel php71w-embedded php71w-gd php71w-mcrypt php71w-mbstring php71w-pdo php71w-xml php71w-fpm php71w-mysqlnd php71w-opcache php71w-pecl-memcached php71w-pecl-redis php71w-pecl-mongodb --nogpgcheck
注意: 如果网络慢可以通过本地rpm方式安装(需要上传rpm包)
配置php 仓库 方法2:
另外一种 在线安装的方法:
yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum -y install php71w php71w-cli php71w-common php71w-devel php71w-embedded php71w-gd php71w-mcrypt php71w-mbstring php71w-pdo php71w-xml php71w-fpm php71w-mysqlnd php71w-opcache php71w-pecl-memcached php71w-pecl-redis php71w-pecl-mongodb --nogpgcheck
查看 安装的 php 包
rpm -qa |grep php
配置php-fpm用户与Nginx的运行用户保持一致
(3): 修改php的启动用户为www
sed -i '/^user/c user = www' /etc/php-fpm.d/www.conf
sed -i '/^group/c group = www' /etc/php-fpm.d/www.conf
4)启动php-fpm加入开机自启
systemctl start php-fpm
systemctl enable php-fpm
查看PHP默认端口号9000
netstat -tunlp