2

I have only acces to the php.ini file and my good old .htaccess file.

Where do I enable the Keep Alive setting?

( Im on a plesk 8.2 )

2 Answers 2

3

Which KeepAlive setting? If you are meaning whether the server supports persistent HTTP connections and how long the relevant timeouts are, then this is not something you can control from .htaccess or php.ini - it is something that can only be configured in the core Apache configuration files.

2
  • I see.. Bummer! But, is it likely virtual / shared hosters will enable it from a customers request? ( i have put on my naive trousers on for now )
    – Sam
    Dec 16, 2010 at 11:06
  • Most hosts will use the default, which is to have it enabled with a timeout of 15s. They may reduce that timeout to reduce server load (as more persistent connections hanging around for longer means needing more Apache workers to serve them), but I wouldn't have thought they'd turn it off as it can significantly reduce the load imposed by a client loading, for example, a HTML page that references many small graphics so is a benefit in a busy shared environment. Dec 16, 2010 at 19:59
0

http://icompile.eladkarako.com/wp-content/uploads/2015/10/whatsapp_emoji_and_icons/e415.png Of course You can!

Place .htaccess file with this content

(upload it using FTP or edit it using a SSH terminal)

<ifModule mod_env.c>
  SetEnv KeepAlive On
  SetEnv KeepAliveTimeout 100
  SetEnv MaxKeepAliveRequests 500
</ifModule>

<ifModule mod_headers.c>
  Header unset Connection
  Header set Connection keep-alive

  Header unset Keep-Alive
  Header set Keep-Alive timeout=100,max=500
</ifModule>

An even more dynamic than a htaccess folder-based configuration - is a PHP file based-one (and the headers too...) just add it to your PHP file. (Before you've started to output any content to the page)

<?php
  /* setting Apache */
  apache_setenv("KeepAlive", "On");
  apache_setenv("KeepAliveTimeout", "100");
  apache_setenv("MaxKeepAliveRequests", "500");

  /* setting headers */
  header("Connection: keep-alive");
  header("Keep-Alive: timeout=100, max=500");

?>


From: iCompile - Keep-Alive - Apache And Headers By .htaccess And PHP

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .