Reputation: 51
in my httpd.conf there is:
KeepAliveTimeout 1
I'm trying to override Apache KeepAliveTimeout setting in a single php script (not in the entire server) so I have a php script with:
header("Keep-Alive: timeout=60, max=100");
but it doesn't seem to make any difference. still I get in the response:
Keep-Alive:timeout=1, max=50
any ideas how to solve this?
Upvotes: 5
Views: 15507
Reputation: 10547
<?php
header('Connection: close');
// other php code here...
// ...
HTTP/1.1 defines the "close" connection option for the sender to
signal that the connection will be closed after completion of the
response. For example,Connection: close
in either the request or the response header fields indicates that the connection SHOULD NOT be considered `persistent' (section 8.1)
after the current request/response is complete.HTTP/1.1 applications that do not support persistent connections MUST include the "close" connection option in every message.
Related: What does “Connection: close” mean when used in the response message?
Upvotes: 0
Reputation: 101
Try setting it in the .htaccess
file combined with a FilesMatch
directive. See this post.
Upvotes: 0
Reputation: 3071
You can't do that. It's there in place for a valid reason.
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.
Upvotes: 2