php自带的webServer解析时出现 Invalid request (Unexpected EOF)报错!

因硬件需求原因,不能安装更多应用,需使用php作为服务,于是利用php自带的webserver搞了一个简单的文件管理脚本。

启动php server命令:

php -S 127.0.0.1:8088 start.php

运行中发现Linux/Window 7下控制台都会报 Invalid request (Unexpected EOF)错误。

于是,在stackoverflow中找到了答案:

首先,这是一个已知的bug

文中提高有三种可能:

1.php脚本无闭合标签。

2.闭合标签后可能有多余的空行。

3.谷歌浏览器的特性有一个Predict network actions to improve page load performance,默认开启的。如果无用的tcp连接次数超过10s,php Server也会显示Invalid request (unexpected EOF)。

[2011-12-08 15:01 UTC] lolautruche at gmail dot com Description:
------------
From time to time, built-in server with router script logs this kind of stuff :

[Thu Dec 8 13:39:29 2011] 127.0.0.1:50358 Invalid request (Unexpected EOF)

This happens quite randomly, whatever the script has a close tag or not, whatever it has a blank line after close tag or not.

Chromium has feature called "Predict network actions to improve page load performance" and its enabled by default. It works this way, that if HTML page has links to some resources, than Chromium opens about 10 TCP connections in advance. And then if browser has less than 10 resources to fetch, unused connections times out after 10 seconds. And this (empty payload) causes PHP server to display "Invalid request (unexpected EOF)" message.

 

This could be related to Chrome specifically and its network prediction feature. So try to disable that feature first. That's why it works for you in Incognito mode, because probably it's disabled in that mode.

You can find this option in Chrome Settings and click on 'Show advanced settings'. Should be there in Privacy section.

Use a prediction service to help complete searches and URLs typed in the address bar or the app launcher search box

原文连接:

https://stackoverflow.com/questions/29141240/php-local-server-invalid-request-unexpected-eof

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值