CentOS 7にPHP-FPM 5.4をインストール（OS標準）

# はじめに

CentOS7にPHP-FPMを標準インストール
親記事：[PHP, PHP-FPMの各種インストール方法とEOLまとめ](https://qiita.com/witchcraze/items/dfe3823554b7caba6f6a)

## LOG

### インストール

```shell-session
# cat /etc/redhat-release
CentOS Linux release 7.7.1908 (Core)

# yum install -y php-fpm which
... 略
```

### php-fpm起動/停止

```shell-session
# systemctl start php-fpm
# systemctl status php-fpm
● php-fpm.service - The PHP FastCGI Process Manager
   Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; disabled; vendor preset: disabled)
   Active: active (running) since Fri 2019-09-27 10:53:12 UTC; 4s ago
 Main PID: 384 (php-fpm)
   Status: "Ready to handle connections"
   CGroup: /docker/2f1a261ac8c94578b42efb309fe97651cdf0492cae1317f887ff4d2cd087a698/docker/2f1a261ac8c94578b42efb309fe97651cdf0492cae1317f887ff4d2cd087a698/system.slice/php-fpm.service
           tq384 php-fpm: master process (/etc/php-fpm.conf)
           tq385 php-fpm: pool www
           tq386 php-fpm: pool www
           tq387 php-fpm: pool www
           tq388 php-fpm: pool www
           mq389 php-fpm: pool www
           ? 384 php-fpm: master process (/etc/php-fpm.conf)

Sep 27 10:53:12 2f1a261ac8c9 systemd[1]: Starting The PHP FastCGI Process Manager...
Sep 27 10:53:12 2f1a261ac8c9 systemd[1]: Started The PHP FastCGI Process Manager.
```

```shell-session
# systemctl stop php-fpm
# systemctl status php-fpm
● php-fpm.service - The PHP FastCGI Process Manager
   Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; disabled; vendor preset: disabled)
   Active: inactive (dead)

Sep 27 10:53:12 2f1a261ac8c9 systemd[1]: Starting The PHP FastCGI Process Manager...
Sep 27 10:53:12 2f1a261ac8c9 systemd[1]: Started The PHP FastCGI Process Manager.
Sep 27 10:53:39 2f1a261ac8c9 systemd[1]: Stopping The PHP FastCGI Process Manager...
Sep 27 10:53:39 2f1a261ac8c9 systemd[1]: Stopped The PHP FastCGI Process Manager.
```

### php-fpm自動起動設定/設定解除

```shell-session
# systemctl enable php-fpm
Created symlink from /etc/systemd/system/multi-user.target.wants/php-fpm.service to /usr/lib/systemd/system/php-fpm.service.

# systemctl list-unit-files --type=service |grep php-fpm
php-fpm.service                        enabled
```

```shell-session
# systemctl disable php-fpm
Removed symlink /etc/systemd/system/multi-user.target.wants/php-fpm.service.

# systemctl list-unit-files --type=service |grep php-fpm
php-fpm.service                        disabled
```

### 各種確認

```shell-session
# which php
which: no php in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin)

# which php-fpm
/usr/sbin/php-fpm

# /usr/sbin/php-fpm -v
PHP 5.4.16 (fpm-fcgi) (built: Oct 30 2018 19:32:20)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

# yum info php-fpm
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
 * base: ftp-srv2.kddilabs.jp
 * extras: ftp-srv2.kddilabs.jp
 * updates: ftp-srv2.kddilabs.jp
Installed Packages
Name        : php-fpm
Arch        : x86_64
Version     : 5.4.16
Release     : 46.el7
Size        : 4.5 M
Repo        : installed
From repo   : base
Summary     : PHP FastCGI Process Manager
URL         : http://www.php.net/
License     : PHP and Zend and BSD
Description : PHP-FPM (FastCGI Process Manager) is an alternative PHP FastCGI
            : implementation with some additional features useful for sites of
            : any size, especially busier sites.
```