thinkphp Swoole 8686 Operation not permitted

在配置Supervisord启动ThinkPHP的Swoole和队列监听服务时遇到权限问题,手动启动则正常。解决方法是停止Supervisord服务,然后手动启动Swoole进行测试,最后重启Supervisord。

在使用supervisord服务时,如果是把thinkphp swoole先添加启动配置文件/etc/supervisord.d/mySwoole.ini:

[program:sw_mi]
command=php think swoole restart
directory=/var/www/mi/
autorestart=true
startsecs=3
startretries=3
stdout_logfile=/var/log/wwwSwoole/sw_mi.out.log
stderr_logfile=/var/log/wwwSwoole/sw_mi.err.log
stdout_logfile_maxbytes=2MB
stderr_logfile_maxbytes=2MB
user=mi
priority=999
numprocs=1
process_name=%(program_name)s_%(process_num)02d

[program:th_mi]
command=php think queue:listen --tries=2
directory=/var/www/mi/
autorestart=true
startsecs=3
startretries=3
stdout_logfile=/var/log/wwwSwoole/th_mi.out.log
stderr_logfile=/var/log/wwwSwoole/th_mi.err.log
stdout_logfile_maxbytes=2MB
stderr_logfile_maxbytes=2MB
user=mi
priority=999
numprocs=1
process_name=%(program_name)s_%(process_num)02d

然后手动启动程序时,会出现:

Swoole 8686 Operation not permitted

这样的奇怪错误,解决办法是停止supervisord服务

systemctl stop supervisord

然后就可以手动启动swoole了,测试好之后,就可以重启服务了

systemctl start supervisord
[root@yfw ~]# cd /www/wwwroot/yfw.szrengjing.com [root@yfw yfw.szrengjing.com]# ./deploy.sh 🔧 开始自动化部署... fatal: not a git repository (or any of the parent directories): .git fatal: not a git repository (or any of the parent directories): .git No composer.json in current directory, do you want to use the one at /www/wwwroot? [Y,n]? y Always want to use the parent dir? Use "composer config --global use-parent-dir true" to change the default. Installing dependencies from lock file Verifying lock file contents can be installed on current platform. Nothing to install, update or remove Generating optimized autoload files 1 package you are using is looking for funding. Use the `composer fund` command to find out more! Could not open input file: think Could not open input file: think chown: changing ownership of 'public/.user.ini': Operation not permitted chmod: changing permissions of 'public/.user.ini': Operation not permitted PHP Warning: require(/www/wwwroot/yfw.szrengjing.com/vendor/autoload.php): failed to open stream: No such file or directory in Standard input code on line 2 Warning: require(/www/wwwroot/yfw.szrengjing.com/vendor/autoload.php): failed to open stream: No such file or directory in Standard input code on line 2 PHP Fatal error: require(): Failed opening required '/www/wwwroot/yfw.szrengjing.com/vendor/autoload.php' (include_path='.:') in Standard input code on line 2 Fatal error: require(): Failed opening required '/www/wwwroot/yfw.szrengjing.com/vendor/autoload.php' (include_path='.:') in Standard input code on line 2 Failed to reload php7.4-fpm.service: Unit php7.4-fpm.service not found. 🎉 部署完成 [root@yfw yfw.szrengjing.com]# lsattr /www/wwwroot/yfw.szrengjing.com/public/.user.ini ----i---------e----- /www/wwwroot/yfw.szrengjing.com/public/.user.ini [root@yfw yfw.szrengjing.com]# chattr -i /www/wwwroot/yfw.szrengjing.com/public/.user.ini [root@yfw yfw.szrengjing.com]# cd /www/wwwroot [root@yfw wwwroot]# [root@yfw wwwroot]# # 备份旧站点 [root@yfw wwwroot]# mv yfw.szrengjing.com yfw.szrengjing.com.bak [root@yfw wwwroot]# [root@yfw wwwroot]# # 使用 Composer 创建新 TP6 项目 [root@yfw wwwroot]# composer create-project topthink/think yfw.szrengjing.com Creating a "topthink/think" project at "./yfw.szrengjing.com" Cannot use topthink/think's latest version v8.1.3 as it requires php >=8.0.0 which is not satisfied by your platform. Installing topthink/think (v6.1.0) - Downloading topthink/think (v6.1.0) - Installing topthink/think (v6.1.0): Extracting archive Created project in /www/wwwroot/yfw.szrengjing.com Loading composer repositories with package information Updating dependencies Lock file operations: 17 installs, 0 updates, 0 removals - Locking league/flysystem (1.1.10) - Locking league/flysystem-cached-adapter (1.1.0) - Locking league/mime-type-detection (1.16.0) - Locking psr/cache (1.0.1) - Locking psr/container (1.1.2) - Locking psr/http-message (1.1) - Locking psr/log (1.1.4) - Locking psr/simple-cache (1.0.1) - Locking symfony/polyfill-mbstring (v1.33.0) - Locking symfony/polyfill-php72 (v1.31.0) - Locking symfony/polyfill-php80 (v1.33.0) - Locking symfony/var-dumper (v4.4.47) - Locking topthink/framework (v6.1.5) - Locking topthink/think-filesystem (v1.0.3) - Locking topthink/think-helper (v3.1.11) - Locking topthink/think-orm (v2.0.62) - Locking topthink/think-trace (v1.6) Writing lock file Installing dependencies from lock file (including require-dev) Package operations: 17 installs, 0 updates, 0 removals - Downloading psr/cache (1.0.1) - Downloading psr/container (1.1.2) - Downloading psr/http-message (1.1) - Downloading symfony/var-dumper (v4.4.47) - Downloading topthink/think-helper (v3.1.11) - Downloading psr/simple-cache (1.0.1) - Downloading psr/log (1.1.4) - Downloading topthink/think-orm (v2.0.62) - Downloading topthink/framework (v6.1.5) - Downloading league/flysystem (1.1.10) - Downloading league/flysystem-cached-adapter (1.1.0) - Downloading topthink/think-filesystem (v1.0.3) - Downloading topthink/think-trace (v1.6) - Installing league/mime-type-detection (1.16.0): Extracting archive - Installing psr/cache (1.0.1): Extracting archive - Installing psr/container (1.1.2): Extracting archive - Installing psr/http-message (1.1): Extracting archive - Installing symfony/polyfill-php80 (v1.33.0): Extracting archive - Installing symfony/polyfill-php72 (v1.31.0) - Installing symfony/polyfill-mbstring (v1.33.0): Extracting archive - Installing symfony/var-dumper (v4.4.47): Extracting archive - Installing topthink/think-helper (v3.1.11): Extracting archive - Installing psr/simple-cache (1.0.1): Extracting archive - Installing psr/log (1.1.4): Extracting archive - Installing topthink/think-orm (v2.0.62): Extracting archive - Installing topthink/framework (v6.1.5): Extracting archive - Installing league/flysystem (1.1.10): Extracting archive - Installing league/flysystem-cached-adapter (1.1.0): Extracting archive - Installing topthink/think-filesystem (v1.0.3): Extracting archive - Installing topthink/think-trace (v1.6): Extracting archive 12 package suggestions were added by new dependencies, use `composer suggest` to see details. Generating autoload files > @php think service:discover Succeed! > @php think vendor:publish Succeed! 6 packages you are using are looking for funding. Use the `composer fund` command to find out more! Found 1 security vulnerability advisory affecting 1 package. Run "composer audit" for a full list of advisories. [root@yfw wwwroot]# ls -la /www/wwwroot/yfw.szrengjing.com total 108 drwxr-xr-x 10 root root 4096 Nov 14 17:05 . drwxr-xr-x 13 www www 4096 Nov 14 17:05 .. drwxr-xr-x 3 root root 4096 Oct 24 2022 app -rw-r--r-- 1 root root 1138 Oct 24 2022 composer.json -rw-r--r-- 1 root root 37667 Nov 14 17:05 composer.lock drwxr-xr-x 2 root root 4096 Nov 14 17:05 config -rw-r--r-- 1 root root 231 Oct 24 2022 .example.env drwxr-xr-x 2 root root 4096 Oct 24 2022 extend -rw-r--r-- 1 root root 34 Oct 24 2022 .gitignore -rw-r--r-- 1 root root 1822 Oct 24 2022 LICENSE.txt drwxr-xr-x 3 root root 4096 Oct 24 2022 public -rw-r--r-- 1 root root 1459 Oct 24 2022 README.md drwxr-xr-x 2 root root 4096 Oct 24 2022 route drwxr-xr-x 2 root root 4096 Oct 24 2022 runtime -rw-r--r-- 1 root root 180 Oct 24 2022 think -rw-r--r-- 1 root root 2038 Oct 24 2022 .travis.yml drwxr-xr-x 8 root root 4096 Nov 14 17:05 vendor drwxr-xr-x 2 root root 4096 Oct 24 2022 view [root@yfw wwwroot]#
最新发布
11-15
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值