报错如下:
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.
2月 25 21:49:00 nginx systemd[1]: Starting The PHP FastCGI Process Manager...
2月 25 21:49:00 nginx php-fpm[86494]: [25-Feb-2025 21:49:00] ERROR: unable to bind listening socket for address '127.0.0.1:9000': Addr...use (98)
2月 25 21:49:00 nginx php-fpm[86494]: [25-Feb-2025 21:49:00] ERROR: FPM initialization failed
2月 25 21:49:00 nginx systemd[1]: php-fpm.service: main process exited, code=exited, status=78/n/a
2月 25 21:49:00 nginx systemd[1]: Failed to start The PHP FastCGI Process Manager.
2月 25 21:49:00 nginx systemd[1]: Unit php-fpm.service entered failed state.
2月 25 21:49:00 nginx systemd[1]: php-fpm.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
[root@nginx /usr/local/nginx/html]#systemctl start php-fpm
解决方法
查看端口:
ss -tunlp | grep php
发现进程中已经有php-fpm存在,将其杀死
杀死进程
pkill -9 php-fpm
systemctl start php-fpm
systemctl status php-fpm
第二中报错可能
在编辑/etc/php-fpm.d/www.conf文件时,user=nginx,但是linux系统中没有创建nginx用户
使用如下方法解决
id nginx
useradd -M -s /usr/sbin/nologin nginx
id nginx
systemctl restart php-fpm
systemctl status php-fpm