Centos7安装PHP

(1)下载和安装PHP

$ sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
$ yum --disablerepo="*" --enablerepo="remi-safe" list php[7-9][0-9].x86_64
$ sudo yum-config-manager --enable remi-php74

(2)连接Nginx 和 MySQL

$ sudo yum install php php-mysqlnd php-fpm

(3)检查PHP版本

$ php --version

(4)编辑PHP设置信息

$ vi /etc/php-fpm.d/www.conf
…
; RPM: apache user chosen to provide access to the same directories as httpd
user = nginx
; RPM: Keep a group allowed to write in log dir.
group = nginx
…
listen = /var/run/php-fpm/php-fpm.sock;
listen.owner = nginx
listen.group = nginx
listen.mode = 0660

(5) 重启

sudo systemctl start php-fpm

参考:

  1. installing-php
上一篇:PHP杂记


下一篇:CentOS7 源码安装PHP