My host, Host Papa (yes, they are rubbish) has disabled mod_deflate,
mod_gzip and php_value auto_prepend_file so can't use them in
.htaccess file. I would move host but I did not realise this was the
case until I wanted to make use of them. I am tied in for three years
so need to find a workaround or live with it.

The site is built using CMS Made Simple (a php based CMS) and I am
using ob_start ("ob_gzhandler"); to compress the html output from the

I want to compress the css and javascript external files as well but
without the apache options available I am wondering what other options
I have. The files are not massive, all but one less than 20k. Not sure
how much of a performance gain I will get but I thought it is worth
while asking the question.

One solution I have on my mind is to call a php script that pulls in
the css and js files and compresses the output e.g

<link rel="stylesheet" type="text/css"


   // initialize ob_gzhandler function to send and compress data
   ob_start ("ob_gzhandler");

   // send the requisite header information and character set
   header ("content-type: text/css; charset: UTF-8");

   // check cached credentials and reprocess accordingly
   header ("cache-control: must-revalidate");

   // set variable for duration of cached content
   $offset = 60 * 60;

   // set variable specifying format of expiration header
   $expire = "expires: " . gmdate ("D, d M Y H:i:s", time() + $offset) . " GMT";

   // send cache expiration header to the client broswer
   header ($expire);

   //read and echo the file
   $file = readfile($_GET["file"]);

   echo $file;



Similar code for javascript with different content-type.

A few questions:

1) Will apache cache the full url or the url minus the query parameter?
2) Are there any performance benefits as there is an overhead in
calling the PHP file?
3) If the PHP call is cached is it cached with the file query parameter?

Many thanks for your help.

-- j

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to