文件 /etc/systemd/system/php53-fpm.service
[Unit]
Description=The PHP53 FastCGI Process Manager
After=syslog.target network.target
[Service]
Type=notify
PIDFile=/usr/local/php53/var/run/php53-fpm.pid
EnvironmentFile=/usr/local/php53/etc/sysconfig/php53-fpm
ExecStart=/usr/local/php53/sbin/php-fpm -c /usr/local/php53/etc/php.ini -y /usr/local/php53/etc/php-fpm.conf --nodaemonize
ExecReload=/bin/kill -USR2 $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
----------------
文件 /usr/local/php53/etc/php-fpm.conf
[global]
pid = /usr/local/php53/var/run/php53-fpm.pid
error_log = /usr/local/php53/var/log/php-fpm.log
; Pool Definitions ;
[www53]
user = nginx
group = nginx
listen = /usr/local/php53/var/run/php-fpm.sock
listen.owner = nobody
listen.group = nobody
日志
Jul 14 01:38:10 lasv5 systemd[1]: Starting The PHP53 FastCGI Process Manager...
Jul 14 01:38:10 lasv5 php-fpm[21696]: [14-Jul-2019 01:38:10] NOTICE: fpm is running, pid 21696
Jul 14 01:38:10 lasv5 php-fpm[21696]: [14-Jul-2019 01:38:10] NOTICE: ready to handle connections
Jul 14 01:39:40 lasv5 systemd[1]: php53-fpm.service start operation timed out. Terminating.
Jul 14 01:39:40 lasv5 php-fpm[21696]: [14-Jul-2019 01:39:40] NOTICE: Terminating ...
Jul 14 01:39:40 lasv5 php-fpm[21696]: [14-Jul-2019 01:39:40] NOTICE: exiting, bye-bye!
Jul 14 01:39:40 lasv5 systemd[1]: Failed to start The PHP53 FastCGI Process Manager.
Jul 14 01:39:40 lasv5 systemd[1]: Unit php53-fpm.service entered failed state.
Jul 14 01:39:40 lasv5 systemd[1]: php53-fpm.service failed.
[Unit]
Description=The PHP53 FastCGI Process Manager
After=syslog.target network.target
[Service]
Type=notify
PIDFile=/usr/local/php53/var/run/php53-fpm.pid
EnvironmentFile=/usr/local/php53/etc/sysconfig/php53-fpm
ExecStart=/usr/local/php53/sbin/php-fpm -c /usr/local/php53/etc/php.ini -y /usr/local/php53/etc/php-fpm.conf --nodaemonize
ExecReload=/bin/kill -USR2 $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
----------------
文件 /usr/local/php53/etc/php-fpm.conf
[global]
pid = /usr/local/php53/var/run/php53-fpm.pid
error_log = /usr/local/php53/var/log/php-fpm.log
; Pool Definitions ;
[www53]
user = nginx
group = nginx
listen = /usr/local/php53/var/run/php-fpm.sock
listen.owner = nobody
listen.group = nobody
日志
Jul 14 01:38:10 lasv5 systemd[1]: Starting The PHP53 FastCGI Process Manager...
Jul 14 01:38:10 lasv5 php-fpm[21696]: [14-Jul-2019 01:38:10] NOTICE: fpm is running, pid 21696
Jul 14 01:38:10 lasv5 php-fpm[21696]: [14-Jul-2019 01:38:10] NOTICE: ready to handle connections
Jul 14 01:39:40 lasv5 systemd[1]: php53-fpm.service start operation timed out. Terminating.
Jul 14 01:39:40 lasv5 php-fpm[21696]: [14-Jul-2019 01:39:40] NOTICE: Terminating ...
Jul 14 01:39:40 lasv5 php-fpm[21696]: [14-Jul-2019 01:39:40] NOTICE: exiting, bye-bye!
Jul 14 01:39:40 lasv5 systemd[1]: Failed to start The PHP53 FastCGI Process Manager.
Jul 14 01:39:40 lasv5 systemd[1]: Unit php53-fpm.service entered failed state.
Jul 14 01:39:40 lasv5 systemd[1]: php53-fpm.service failed.
9 条回复 • 2019-07-15 02:03:40 +08:00
|
1
azev OP 在 90 秒内
访问网站没有问题 90 秒时就终止了 怀疑是权限的问题 但没有看到这个错误 |
|
2
dot2017 2019 年 7 月 14 日
Jul 14 01:39:40 lasv5 systemd[1]: php53-fpm.service start operation timed out. Terminating.
你这服务其实没起来啊 |
|
3
taolu 2019 年 7 月 14 日 via Android
type 改成 simple 或者 forking,fpm 启动后不向 systemd 发送消息的吧
|
|
4
taolu 2019 年 7 月 14 日
|
|
5
des 2019 年 7 月 14 日
|
|
6
itechify 2019 年 7 月 14 日 via Android
type 为 fork
|
|
7
azev OP @taolu @des
多谢 确实是 type 的问题 目前改成 simple 就可以了 查了下 应该是在 php5.4 之后才可以使用 notify 而我部署的是 5.3 复制了其他机器 5.4 的配置 所以出错了 @oneisall8955 确定可以用 fork 吗? 这个 php-fpm 自己就会按照 php-fpm.conf 里的设置进行 fork 吧 |
|
8
itechify 2019 年 7 月 14 日 via Android
@azev 以前我创建 service 的设置用 fork 有效,simple 没试过噢,你用 simple 可以的话,那就行了吧~太久没搞过 systemd 的 service,怕是误导你了,抱歉😨
|
|
9
ryd994 2019 年 7 月 15 日 via Android
simple 就是如果启动的前端进程退出了,那就是服务结束了,子进程会被杀掉。
forking 会检测还有没有子进程活着,如果还有,那就认为服务还在。 如果支持 foreground 模式的程序,建议用 simple,可以直接 log 输出内容到 journald 如果只支持传统的,前端进程 fork daemon 后前端自己返回退出,留下 daemon,那就只能用 simple |