转载请注明出处,如果您觉得文章有用,就点个赞吧!
问题
# php think swoole start
启动swoole报错如下:
[TypeError]
Argument 1 passed to think\swoole\PidManager::__construct() must be of the type string, null given, called in /home/htdocs/tp6/vendor/topthink/think-swoole/src/command/Server.php on li
ne 43
分析过程
根据错误信息查看源代码
vim /home/htdocs/tp6/vendor/topthink/think-swoole/src/command/Server.php
发现应该有swoole.php这个配置文件,而config中并没有发现此文件
于是…
find / -name swoole.php
解决方法
将其复制到config目录中
cp vendor/topthink/think-swoole/src/config/swoole.php config/swoole.php
在启动,已正常运行
# php think swoole start
# 提示如下,表示已正常运行
Starting swoole http server...
Swoole http server started: <http://127.0.0.1:80>
You can exit with `CTRL-C`