![无法在 ubuntu 20.04 上启动 php-fpm](https://linux22.com/image/777935/%E6%97%A0%E6%B3%95%E5%9C%A8%20ubuntu%2020.04%20%E4%B8%8A%E5%90%AF%E5%8A%A8%20php-fpm.png)
我正在尝试启动 php8.1-fpm,但出现以下错误(而 php8.0-fpm 和 php7.4-fpm 可以正确启动)。如能得到任何帮助,我将不胜感激。
[root@ ~]# systemctl status php8.1-fpm.service
● php8.1-fpm.service - The PHP 8.1 FastCGI Process Manager
Loaded: loaded (/lib/systemd/system/php8.1-fpm.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2022-06-14 17:06:17 EEST; 5s ago
Docs: man:php-fpm8.1(8)
Process: 39682 ExecStart=/usr/sbin/php-fpm8.1 --nodaemonize --fpm-config /etc/php/8.1/fpm/php-fpm.conf (code=exited, status=78)
Process: 39693 ExecStopPost=/usr/lib/php/php-fpm-socket-helper remove /run/php/php-fpm.sock /etc/php/8.1/fpm/pool.d/www.conf 81 (code=exited, status=0/SUCCESS)
Main PID: 39682 (code=exited, status=78)
Jun 14 17:06:17 domain.com systemd[1]: Starting The PHP 8.1 FastCGI Process Manager...
Jun 14 17:06:17 domain.com php-fpm8.1[39682]: [14-Jun-2022 17:06:17] ERROR: unable to bind listening socket for address 'localhost:8002': Address already in use (98)
Jun 14 17:06:17 domain.com php-fpm8.1[39682]: [14-Jun-2022 17:06:17] ERROR: FPM initialization failed
Jun 14 17:06:17 domain.com systemd[1]: php8.1-fpm.service: Main process exited, code=exited, status=78/CONFIG
Jun 14 17:06:17 domain.com systemd[1]: php8.1-fpm.service: Failed with result 'exit-code'.
Jun 14 17:06:17 domain.com systemd[1]: Failed to start The PHP 8.1 FastCGI Process Manager.
答案1
看来你的本地主机上已经有 8002 端口上运行一个进程
识别该进程netstat -ltnp | grep -w ':8002'
并检查是否可以终止它
如果另一个进程需要端口 8002,您可以在文件中更改 php-fpm 端口/etc/php/8.1/fpm/pool.d/www.conf