如何使用PHP覆盖Apache keep-alive头?

在我的httpd.conf中有:

KeepAliveTimeout 1

我试图在一个PHP脚本(不是整个服务器)中覆盖Apache KeepAliveTimeout设置,所以我有一个PHP脚本:

header("Keep-Alive: timeout=60, max=100"); 

但它似乎没有任何区别.我还是得到了答复:

Keep-Alive:timeout=1, max=50

任何想法如何解决这个问题?

最佳答案 你不能这样做.它是有正当理由的.

Apache v2.2 Core Features

KeepAliveTimeout指令

The number of seconds Apache will wait for a subsequent request before
closing the connection. Once a request has been received, the timeout
value specified by the Timeout directive applies.

Setting KeepAliveTimeout to a high value may cause performance
problems in heavily loaded servers. The higher the timeout, the more
server processes will be kept occupied waiting on connections with
idle clients.

点赞