• 安装php-fpm
yum install -y php72w php72w-fpm
yum install -y php72w-mysql php72w-pdo php72w-devel php72w-gd 
#其它插件
php72w-pecl-memcache php72w-pspell php72w-snmp php72w-xmlrpc php72w-xml
php72w-pecl-redis php72w-soap
php72w-pgsql

#看看php版本
php -v
  • 启动php-fpm
systemctl start php-fpm
systemctl enable php-fpm
  • 配置 nginx /etc/nginx/conf.d/
#在 server 中插入如下代码
location ~ \.php$ {
    try_files $uri =404;
    fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
    ###Save user landing page to cookie: srcid for PHP files
    ##add_header Set-Cookie $srcid;
}
  • 修改 php-fpm 配置 /etc/php-fpm.d/www.conf
user = nginx 
group = nginx 
listen = /var/run/php-fpm/php-fpm.sock 

listen.owner = nignx
listen.group = nginx
listen.mode = 0660
  • 修改 /etc/php.inip [如果没报错可以不改]
cgi.fix_pathinfo=0
  • 重启服务
systemctl restart php-fpm
systemctl restart nginx