PHP-FPM 설치하기

yum을 이용하면 php-fpm을 아주 쉽고 간단하게 설치 할 수 있습니다. 단 최신버전을 설치 하고 싶으시다면 remi repository를 설치 하여야 합니다.

Remi Repository 설치 방법 : http://webinformation.tistory.com/12

[root@localhost ~]# yum install php-fpm
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.jaist.ac.jp
 * epel: repo.ugm.ac.id
 * extras: www.ftp.ne.jp
 * remi: mirror.23media.de
 * remi-php71: mirror.23media.de
 * remi-safe: mirror.23media.de
 * updates: ftp.jaist.ac.jp
Resolving Dependencies
--> Running transaction check
---> Package php-fpm.x86_64 0:7.1.7-1.el7.remi will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package        Arch          Version                   Repository         Size
================================================================================
Installing:
 php-fpm        x86_64        7.1.7-1.el7.remi          remi-php71        1.6 M

Transaction Summary
================================================================================
Install  1 Package

Total download size: 1.6 M
Installed size: 4.7 M
Is this ok [y/d/N]: y
Downloading packages:
php-fpm-7.1.7-1.el7.remi.x86_64.rpm                        | 1.6 MB   00:02
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : php-fpm-7.1.7-1.el7.remi.x86_64                              1/1
  Verifying  : php-fpm-7.1.7-1.el7.remi.x86_64                              1/1

Installed:
  php-fpm.x86_64 0:7.1.7-1.el7.remi

Complete!

Apache httpd 설정

아래와 같이 원래 있던 라인은 주석처리 하시고 그 아래에 SetHandler를 입력해주시면 됩니다.

[root@localhost ~]# vim /etc/httpd/conf.d/php.conf
# 저는 31 라인 입니다만 각자 다 다르겠죠?
<FilesMatch \.php$>
#    SetHandler application/x-httpd-php
    SetHandler "proxy:fcgi://127.0.0.1:9000" 
</FilesMatch>

서비스 재시작

[root@localhost ~]# systemctl start php-fpm 
[root@localhost ~]# systemctl enable php-fpm 
[root@localhost ~]# systemctl restart httpd