CentOS 7 裝 PHP FPM

因為我們是用 CentOS Software Collection 的 PHP 7,所以 PHP FPM 也要用 SCL 提供的。

主要是參考 CentOS 7 安裝 Nginx、MySQL/MariaDB、PHP7,架設 LEMP 網頁伺服器筆記

先把 PHP FPM 裝起來:

> sudo yum install rh-php72-php-fpm

修改 /etc/opt/rh/rh-php72/php-fpm.d/www.conf,把 user、group 設定為 nginx:

; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
; will be used.
; RPM: apache user chosen to provide access to the same directories as httpd
;user = apache
user = nginx
; RPM: Keep a group allowed to write in log dir.
;group = apache
group = nginx

把 PHP FPM 跑起來:

> sudo systemctl start rh-php72-php-fpm

再把 PHP FPM 設為開機啟動服務:

> sudo systemctl enable rh-php72-php-fpm

下一篇來研究 nginx X PHP FPM 的作法。

Comments