try catch 捕获异常发现没有写入权限。
分析原因:linux的添加定时任务时默认是当前登录用户,我定时任务会生成日志
方案:
1.定时任务用户和php-fpm用户统一成一个。
crontab -u root -l //复制
crontab -u nobody -e //添加
crontab -u root -r //删除
2. 修改日志类的参数
$handler = new RotatingFileHandler($path, LOG_FILE_NUM, Logger::DEBUG,true,0777);
ps
crontab 用法
# crontab -nobody -l
crontab: invalid option -- 'n'
crontab: usage error: unrecognized option
usage: crontab [-u user] file
crontab [-u user] [ -e | -l | -r ]
(default operation is replace, per 1003.2)
-e (edit user's crontab)
-l (list user's crontab)
-r (delete user's crontab)
-i (prompt before deleting user's crontab)
-s (selinux context)