DEV Community

Cover image for CentOS 7 裝 PHP FPM
Leon
Leon

Posted on • Originally published at editor.leonh.space

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
Enter fullscreen mode Exit fullscreen mode

修改 /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
Enter fullscreen mode Exit fullscreen mode

把 PHP FPM 跑起來:

> sudo systemctl start rh-php72-php-fpm
Enter fullscreen mode Exit fullscreen mode

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

> sudo systemctl enable rh-php72-php-fpm
Enter fullscreen mode Exit fullscreen mode

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

Top comments (0)