systemd centos7を使用して実行するとphp-fpm56がタイムアウトします。

systemd centos7を使用して実行するとphp-fpm56がタイムアウトします。

次のフラグを使用して、CentOS 7でICU4C 64_2を使用して独自のPHP 5.6.40(fpmを含む)をコンパイルしました。

./configure CXXFLAGS="-std=c++11 -DU_USING_ICU_NAMESPACE=1" \
        --prefix=/usr/local/php56 \
        --program-suffix=56 \
        --enable-fpm \
        --with-config-file-scan-dir=/usr/local/php56/lib/php.conf.d \
        --with-curl \
        --with-gd \
        --enable-gd-native-ttf \
        --with-gettext \
        --with-jpeg-dir=/usr/local/lib \
        --with-freetype-dir=/usr/local/lib \
        --with-libxml-dir=/usr/local/lib \
        --with-kerberos \
        --with-openssl \
        --with-mcrypt \
        --with-mhash \
        --with-mysql=mysqlnd \
        --with-mysql-sock=/var/lib/mysql/mysql.sock \
        --with-mysqli=mysqlnd \
        --with-pdo-mysql=mysqlnd \
        --with-pear \
        --with-png-dir=/usr/local/lib \
        --with-xsl \
        --with-zlib \
        --enable-zip \
        --with-iconv=/usr/local \
        --enable-bcmath \
        --enable-calendar \
        --enable-exif \
        --enable-ftp \
        --enable-sockets \
        --enable-soap \
        --enable-mbstring \
        --with-icu-dir=/usr/local/icu \
        --enable-intl

プログラムが正常にコンパイルおよびインストールされ、PHPが完全に実行されます。

systemdを使用してphp-fpm56を処理するために、次のサービスファイルをビルドしました。

[Unit]
Description=The PHP FastCGI Process Manager
After=syslog.target network.target

[Service]
Type=notify
PIDFile=/run/php-fpm56.pid
ExecStart=/usr/local/php56/sbin/php-fpm56 --nodaemonize --pid=/run/php-fpm56.pid --fpm-config /usr/local/php56/etc/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID
LimitMEMLOCK=infinity
LimitNOFILE=65535

PrivateTmp=true
PrivateDevices=true
ProtectKernelModules=true
ProtectKernelTunables=true
ProtectControlGroups=true
RestrictRealtime=true
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX

[Install]
WantedBy=multi-user.target

/usr/local/php56/etc/php-fpm.conf:

[global]
error_log = /var/log/php-fpm56.log
emergency_restart_threshold = 3
emergency_restart_interval = 1m
process_control_timeout = 5

log_level = notice

;;;;;;;;;;;;;;;;;;;;
; Pool Definitions ;
;;;;;;;;;;;;;;;;;;;;

[webapps]
user = $pool
group = $pool

listen = /usr/local/php56/sockets/$pool.sock
listen.owner = $pool
listen.group = nginx
listen.mode = 660

pm = ondemand
pm.max_children = 10
pm.process_idle_timeout = 60
pm.max_requests = 1000

security.limit_extensions = .php .php5 .php56 .inc .phtml

include=/etc/booting/users_data/*/php-fpm56.conf

サービスを開始しようとするとタイムアウトが発生します。

php-fpm56.service - The PHP FastCGI Process Manager
   Loaded: loaded (/usr/lib/systemd/system/php-fpm56.service; enabled; vendor preset: disabled)
   Active: failed (Result: timeout) since Sun 2019-10-27 14:00:17 IST; 2min 12s ago
  Process: 10008 ExecStart=/usr/local/php56/sbin/php-fpm56 --nodaemonize --pid=/run/php-fpm56.pid --fpm-config /usr/local/php56/etc/php-fpm.conf (code=exited, status=0/SUCCESS)
 Main PID: 10008 (code=exited, status=0/SUCCESS)

Oct 27 13:58:47 asdasd.booting.cloud systemd[1]: Starting The PHP FastCGI Process Manager...
Oct 27 13:58:47 asdasd.booting.cloud php-fpm56[10008]: [27-Oct-2019 13:58:47] WARNING: Nothing matches the include pattern '/etc/booting/users_data/*/php-fpm56.conf' from /usr/local/php56/etc/php-fpm.conf at line 29.
systemd[1]: php-fpm56.service start operation timed out. Terminating.
systemd[1]: Failed to start The PHP FastCGI Process Manager.
systemd[1]: Unit php-fpm56.service entered failed state.
systemd[1]: php-fpm56.service failed.

ログファイル:

NOTICE: fpm is running, pid 10008
NOTICE: ready to handle connections
NOTICE: Terminating ...
NOTICE: exiting, bye-bye!

スタートアップ失敗の原因が何であるかを把握するのに助けが必要です。私はphp7.2に対して同じ設定をし、問題なく動作しました。

ベストアンサー1

答えは設定に欠けているフラグです。

--with-fpm-systemd

おすすめ記事