php - 如何使用 php 覆盖 Apache keep-alive header ?

标签 php apache http web

在我的 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.

关于php - 如何使用 php 覆盖 Apache keep-alive header ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15308404/

相关文章:

javascript - 在http get map中创建新对象

php - 使用 PHP 更改查询的日期

PHP 到 PDF 分页

php - 更新 max_input_vars 后仍收到 "Input Variables Exceeded 1000"错误

svn - AuthzSVNAccessFile 的编码

Apache-MaxClients

php - 如何防止 MySQL 数值发生变化? (phpMyAdmin)

javascript - 使用 JavaScript 验证

Java 9 HttpClient 发送多部分/表单数据请求

php - 将 iPhone HTTP 请求发送到 Apache PHP 网络服务器