Fatal error: Uncaught Swoole\Exception: Swoole\Http\Server can only be used in CLI mode in
2020-04-07 19:00
2441 查看
如果你觉得有用的,可以帮我点个赞么?让我知道帮助了你
Fatal error: Uncaught Swoole\Exception: Swoole\Http\Server can only be used in CLI mode in /home/wwwroot/default/twj/swoole/server/http_server.php:5 Stack trace: #0 /home/wwwroot/default/twj/swoole/server/http_server.php(5): Swoole\Server->__construct('0.0.0.0', 8811) #1 {main} thrown in /home/wwwroot/default/twj/swoole/server/http_server.php on line 5
在执行swolle 的 http_server时候,遇到上面的这个错误,意思就是我们没有使用cli模式去访问。
大家可以使用这个函数来看看你当前的模式
[code]php_sapi_name();
代码:
浏览器上访问:
linux系统命令行看到是cli
这时候我们又想通过浏览器访问,怎么办?
用虚拟域名+监听的端口就可以了,如图
我没有配置虚拟域名,我是通过我的服务器IP+端口来访问到这个页面的
这时候我们去看监听的文件,显示是cli
如果你觉得有用的,可以帮我点个赞么?让我知道帮助了你
- 点赞 1
- 收藏
- 分享
- 文章举报
相关文章推荐
- swoole 4.2.11 报错【async-io must be used in PHP CLI mode】 以及 websocket server收到的数据总是乱码的问题
- Python SQLite3的问题sqlite3.ProgrammingError: SQLite objects created in a thread can only be used in th
- [django] Exception Value: DatabaseWrapper objects created in a thread can only be used in that same
- Silverlight + WCF + EF4 调用出错,Server 端的Exception:The ObjectContext instance has been disposed and can no longer be used for operations that require a connection.
- Array constants can only be used in initializers
- Grid can not be used in this ('quirks') mode!
- java.lang.IllegalArgumentException: FormUrlEncoded can only be specified on HTTP methods with requ
- 多线程下,Python Sqlite3报[SQLite objects created in a thread can only be used...]问题
- Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive
- vs2005下出现“Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive”的解决方法
- 一些老版本的DEMO经常会出现的错误(ld: -pie can only be used when targeting iOS 4.2 or later clang: error: linker c)
- Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.
- Fatal error: Uncaught SoapFault exception: [Client] looks like we got no XML document in
- An error occurred at line: 7 in the generated java file Only a type can be imported. java.util.list
- android.view.InflateException: <merge /> can be used only with a valid ViewGroup root and attachToRo
- hadoop错误FATAL org.apache.hadoop.hdfs.server.namenode.NameNode Exception in namenode join java.io.IOException There appears to be a gap in the edit log
- coco2dx新建项目报错,ld: -pie can only be used when targeting iOS 4.2 or later clang: error: linker command
- Xcode 6.2 error::can only be used when targeting iOS 4.2 or later
- jqGrid不支持IE8的解决办法(Grid can not be used in this ('quirks') mode)
- You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.