当前位置: 首页 > 后端技术 > PHP

workerman源码-安装workerman

时间:2023-03-29 21:25:11 PHP

阅读源码的第一步是将工具安装到自己的服务中。workerman的安装方式我推荐使用composer。以后会在composerinstall后在vendor目录截取源码。安装workermancomposerrequireworkerman/workerman,等待安装完成。如果因为镜像源问题导致安装缓慢,请使用阿里的镜像源//全局配置composerconfig-grepo.packagistcomposerhttps://mirrors.aliyun.com/composer///当前项目配置composerconfigrepo。packagistcomposerhttps://mirrors.aliyun.com/composer/版本区别这里安装的版本是普通版。是win和linux都可以用的版本。linux和win没有区别。不过win版在官方文档中有说明。1、win版的count属性无效,都是单进程。2、不支持startstopreloadrestartstatus命令。3、cmd命令行启动,后面可以连接多个文件,如phpstart_web.phpstart_gateway.phpstart_worker.php4、进程无法守护,cmd窗口关闭后服务停止。5.每个启动文件只能实例化一个容器(Worker/WebServer/Gateway/BusinessWorker),需要实例化多个容器需要拆分成多个文件,比如start_web.phpstart_gateway.phpstart_worker.php来初始化web网关工人分别。请特别注意我们在这里阅读的workerman3.5版本。如果超过3.5版本,源码可能会出现不同的地方。请自行处理。最后的原地址