php-fpmが、「’127.0.0.1:9000′: Address already in use」で再起動できない
# systemctl restart php-fpm Job for php-fpm.service failed because the control process exited with error code. See "systemctl status php-fpm.service" and "journalctl -xe" for details.
↑php-fpmが、エラーで再起動できない。
# systemctl status php-fpm ● php-fpm.service - LSB: starts php-fpm Loaded: loaded (/etc/rc.d/init.d/php-fpm; bad; vendor preset: disabled) Active: failed (Result: exit-code) since Mon 2021-XX-XX XX:XX:XX JST; 8s ago Docs: man:systemd-sysv-generator(8) Process: 27705 ExecStart=/etc/rc.d/init.d/php-fpm start (code=exited, status=1/FAILURE) XXXX systemd[1]: Starting LSB: starts php-fpm... XXXX php-fpm[27705]: Starting php-fpm [XX-XX-2021 XX:XX:XX] ERROR: unable to bind listening socket for address '127.0.0.1:9000': Address already in use (98) XXXX php-fpm[27705]: [XX-XX-2021 XX:XX:XX] ERROR: FPM initialization failed XXXX php-fpm[27705]: failed XXXX systemd[1]: php-fpm.service: control process exited, code=exited status=1 XXXX systemd[1]: Failed to start LSB: starts php-fpm. XXXX systemd[1]: Unit php-fpm.service entered failed state. XXXX systemd[1]: php-fpm.service failed.
↑「systemctl status」コマンドで、みると、「’127.0.0.1:9000′: Address already in use」と出てきます。
# netstat -an |grep 9000 tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:9000 127.0.0.1:45044 TIME_WAIT tcp 0 0 127.0.0.1:9000 127.0.0.1:45344 TIME_WAIT tcp 0 0 127.0.0.1:9000 127.0.0.1:44940 TIME_WAIT tcp 0 0 127.0.0.1:9000 127.0.0.1:45294 TIME_WAIT tcp 0 0 127.0.0.1:9000 127.0.0.1:45008 TIME_WAIT tcp 0 0 127.0.0.1:9000 127.0.0.1:45224 TIME_WAIT tcp 0 0 127.0.0.1:9000 127.0.0.1:45222 TIME_WAIT tcp 0 0 127.0.0.1:9000 127.0.0.1:45412 TIME_WAIT tcp 0 0 127.0.0.1:9000 127.0.0.1:44918 TIME_WAIT tcp 0 0 127.0.0.1:9000 127.0.0.1:45274 TIME_WAIT tcp 0 0 127.0.0.1:9000 127.0.0.1:45292 TIME_WAIT tcp 0 0 127.0.0.1:9000 127.0.0.1:44986 TIME_WAIT tcp 0 0 127.0.0.1:9000 127.0.0.1:44938 TIME_WAIT tcp 0 0 127.0.0.1:9000 127.0.0.1:44908 TIME_WAIT tcp 0 0 127.0.0.1:9000 127.0.0.1:44988 TIME_WAIT tcp 0 0 127.0.0.1:9000 127.0.0.1:45248 TIME_WAIT tcp 0 0 127.0.0.1:9000 127.0.0.1:45006 TIME_WAIT tcp 0 0 127.0.0.1:9000 127.0.0.1:45016 TIME_WAIT tcp 0 0 127.0.0.1:9000 127.0.0.1:44970 TIME_WAIT
↑9000ポートに関して、「TIME_WAIT」状態のソケットがたくさん起動しています。
php-fpmのプロセスを落とす
# ps ax |grep php-fpm 1021 ? Ss 0:00 php-fpm: master process (/usr/local/etc/php-fpm.conf) 1027 ? S 0:00 php-fpm: pool www 1028 ? S 0:00 php-fpm: pool www 27803 pts/0 S+ 0:00 grep --color=auto php
↑「php-fpm」に関するプロセスを確認します。
# kill -9 1021 1027 1028
↑上記、左側数字を「kill -9」コマンドで、プロセスを落とします。
# ps ax |grep php-fpm 27819 pts/0 S+ 0:00 grep --color=auto php-fpm
↑php-fpm関係のプロセスが無くなり、php-fpmが停止しました。
php-fpm再起動
# systemctl start php-fpm # systemctl status php-fpm ● php-fpm.service - LSB: starts php-fpm Loaded: loaded (/etc/rc.d/init.d/php-fpm; bad; vendor preset: disabled) Active: active (running) since Tue 2021-XX-XX XX:XX:XX JST; 3s ago Docs: man:systemd-sysv-generator(8) Process: 30207 ExecStart=/etc/rc.d/init.d/php-fpm start (code=exited, status=0/SUCCESS) CGroup: /system.slice/php-fpm.service ├─30209 php-fpm: master process (/usr/local/etc/php-fpm.conf) ├─30210 php-fpm: pool www └─30211 php-fpm: pool www XXXX systemd[1]: Starting LSB: starts php-fpm... XXXX php-fpm[30207]: Starting php-fpm done XXXX systemd[1]: Started LSB: starts php-fpm.
↑無事、php-fpmが起動しました。