沉默PHP 7.4.8服务器请求日志“已接受”,“正在关闭”

时间:2020-08-05 10:10:51

标签: php logging server silent php-7.4

从PHP 7.3更新到PHP 7.4.8之后,我注意到服务器已开始为所有请求记录“接受”,“关闭”,有时:“关闭而未发送请求;这可能只是未使用的推测预连接”。

[Wed Aug  5 17:51:27 2020] PHP 7.4.8 Development Server (http://localhost:3000) started
[Wed Aug  5 17:51:37 2020] 127.0.0.1:37788 Accepted
[Wed Aug  5 17:51:37 2020] 127.0.0.1:37792 Accepted
[Wed Aug  5 17:51:37 2020] 127.0.0.1:37788 [200]: (null) /
[Wed Aug  5 17:51:37 2020] 127.0.0.1:37788 Closing

[Wed Aug  5 17:52:02 2020] 127.0.0.1:37808 Closed without sending a request; it was probably just an unused speculative preconnection
[Wed Aug  5 17:52:02 2020] 127.0.0.1:37808 Closing

我想知道是否存在以“静默”模式启动服务器的选项,该模式下日志仅包含信息,警告和错误。

1 个答案:

答案 0 :(得分:0)

如果您自己启动 PHP 服务器,向它传递 -q--no-header 参数(安静模式)为我解决了这个问题:

php -q -S 127.0.0.1:8080 index.php

见:https://stackoverflow.com/a/66864545

相关问题