Compressing both php and linked css files with ob_gzhandler and htaccess

This is a discussion on Compressing both php and linked css files with ob_gzhandler and htaccess within the PHP General forums, part of the PHP Programming Forums category; Can I compress a php file AND its referenced css files at the same time ? Currently, I am using ob_gzhandler ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-13-2006
Graham Anderson
 
Posts: n/a
Default Compressing both php and linked css files with ob_gzhandler and htaccess

Can I compress a php file AND its referenced css files at the same
time ?

Currently, I am using ob_gzhandler to compress my php files only .
Works great:)


As I have found that you CAN NOT use ob_gz and zlib at the same time,
how do I amend the htaccess file to use ob_gz,

These files are in my CSS folder along with style.css.
..
..htaccess
AddHandler application/x-httpd-php .css
php_value auto_prepend_file gzip-css.php
php_flag zlib.output_compression On

gzip-css.php
<?php
ob_start ("ob_gzhandler");
header("Content-type: text/css; charset: UTF-8");
header("Cache-Control: must-revalidate");
$offset = 60 * 60 ;
$ExpStr = "Expires: " .
gmdate("D, d M Y H:i:s",
time() + $offset) . " GMT";
header($ExpStr);
?>

many thanks as I am learning the ins and outs of htaccess and
ob_gzhandler
Reply With Quote
  #2 (permalink)  
Old 11-13-2006
Jochem Maas
 
Posts: n/a
Default Re: [PHP] Compressing both php and linked css files with ob_gzhandlerand htaccess

Graham Anderson wrote:
> Can I compress a php file AND its referenced css files at the same time ?
>
> Currently, I am using ob_gzhandler to compress my php files only .
> Works great:)
>
>
> As I have found that you CAN NOT use ob_gz and zlib at the same time,
> how do I amend the htaccess file to use ob_gz,


er ...

>
> These files are in my CSS folder along with style.css.
> .
> .htaccess
> AddHandler application/x-httpd-php .css
> php_value auto_prepend_file gzip-css.php
> php_flag zlib.output_compression On


php_flag zlib.output_compression Off

>


no?

> gzip-css.php
> <?php
> ob_start ("ob_gzhandler");
> header("Content-type: text/css; charset: UTF-8");
> header("Cache-Control: must-revalidate");
> $offset = 60 * 60 ;
> $ExpStr = "Expires: " .
> gmdate("D, d M Y H:i:s",
> time() + $offset) . " GMT";
> header($ExpStr);
> ?>
>
> many thanks as I am learning the ins and outs of htaccess and ob_gzhandler
>
> --PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

Reply With Quote
  #3 (permalink)  
Old 11-13-2006
Graham Anderson
 
Posts: n/a
Default Re: [PHP] Compressing both php and linked css files with ob_gzhandler and htaccess

yes :)

I DID try that

strangely, turning it off disables/kills the css file

g


On Nov 13, 2006, at 2:08 PM, Jochem Maas wrote:

> Graham Anderson wrote:
>> Can I compress a php file AND its referenced css files at the
>> same time ?
>>
>> Currently, I am using ob_gzhandler to compress my php files only .
>> Works great:)
>>
>>
>> As I have found that you CAN NOT use ob_gz and zlib at the same time,
>> how do I amend the htaccess file to use ob_gz,

>
> er ...
>
>>
>> These files are in my CSS folder along with style.css.
>> .
>> .htaccess
>> AddHandler application/x-httpd-php .css
>> php_value auto_prepend_file gzip-css.php
>> php_flag zlib.output_compression On

>
> php_flag zlib.output_compression Off
>
>>

>
> no?
>
>> gzip-css.php
>> <?php
>> ob_start ("ob_gzhandler");
>> header("Content-type: text/css; charset: UTF-8");
>> header("Cache-Control: must-revalidate");
>> $offset = 60 * 60 ;
>> $ExpStr = "Expires: " .
>> gmdate("D, d M Y H:i:s",
>> time() + $offset) . " GMT";
>> header($ExpStr);
>> ?>
>>
>> many thanks as I am learning the ins and outs of htaccess and
>> ob_gzhandler
>>
>> --PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>

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

Reply With Quote
  #4 (permalink)  
Old 11-13-2006
Graham Anderson
 
Posts: n/a
Default Re: [PHP] Compressing both php and linked css files with ob_gzhandler and htaccess

Unfortunately, I am on a shared server for this project :(
Is there some way to enable mod_deflate without admin server privs?

many thanks

On Nov 13, 2006, at 1:59 PM, steve wrote:

> Why use php to compress at all? Use mod_deflate.
>
> On 11/13/06, Graham Anderson <grahama@siren.cc> wrote:
>> Can I compress a php file AND its referenced css files at the same
>> time ?
>>
>> Currently, I am using ob_gzhandler to compress my php files only .
>> Works great:)
>>
>>
>> As I have found that you CAN NOT use ob_gz and zlib at the same time,
>> how do I amend the htaccess file to use ob_gz,
>>
>> These files are in my CSS folder along with style.css.
>> .
>> .htaccess
>> AddHandler application/x-httpd-php .css
>> php_value auto_prepend_file gzip-css.php
>> php_flag zlib.output_compression On
>>
>> gzip-css.php
>> <?php
>> ob_start ("ob_gzhandler");
>> header("Content-type: text/css; charset: UTF-8");
>> header("Cache-Control: must-revalidate");
>> $offset = 60 * 60 ;
>> $ExpStr = "Expires: " .
>> gmdate("D, d M Y H:i:s",
>> time() + $offset) . " GMT";
>> header($ExpStr);
>> ?>
>>
>> many thanks as I am learning the ins and outs of htaccess and
>> ob_gzhandler
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 12:18 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0