当前位置:编程学习 > thinkphp >>

php think swoole start 执行后cpu立刻100%

启动swoole后台cpu立刻100%有很多原因,这里分享1个:

关闭文件变化监控:



'file_monitor'=>false,//关闭文件变化监控 
'file_monitor_interval'=>10,//10秒刷新文件变化1次




首先按照Swoole官网说明安装swoole扩展,然后使用

composer require topthink/think-swoole
安装think-swoole扩展。

由于Swoole不支持windows环境,所以你无法在windows环境下测试,只能使用虚拟机或者WSL环境测试。

HTTP服务
直接在命令行下启动HTTP服务端。

php think swoole
启动完成后,默认会在0.0.0.0:80启动一个HTTP Server,可以直接访问当前的应用。相关配置参数可以在config/swoole.php里面配置(具体参考配置文件内容)。

支持的其它操作包括:

启动HTTP服务(默认)

php think swoole start


停止服务

php think swoole stop


重启服务

php think swoole restart


reload服务
php think swoole reload

守护进程模式
如果需要使用守护进程方式运行,可以配置

'options'   =>  [
    'daemonize' =>  true
]
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,