Hello,
On 10/15/2004 06:22 PM, David Hamilton wrote:
I'm currently re-designing my company's website. One of our major
concerns is load time. I happened to stumble across some information on
using zlib to compress pages using PHP.
The advice seemed "to good to be true" the recommendation was setup an .htaccess file with the following:
php_flag zlib.output_compression on php_value zlib.output_compression_level 6
It was my understanding this turns on output compression meaning that any page parsed any ".php" (or any other extension associated with php) will have its contents compressed if the requesting browser supports HTTP 1.1
Is this correct? If not can anyone point in the proper direction of doing this? I'm mainly interested in compressing a few key pages and a somewhat bloated .js file (which I realize the method above wouldn't do unless I ask to the server to parse .js as PHP...probably not a good idea...)
In theory yes, it will compress the pages served by PHP to browsers that support it. In practice, there are a few problems that advise to not use the current PHP functionality, and use instead mod_gzip if you use Apache 1.x because it comes with special workarounds for situations of browsers that do not conform to the standards and other things like proxies that should not be caching compressed responses.
Furthermore, mod_gzip will also compress HTML pages not generated by PHP.
I think Apache 2.x comes with built-in compression filter but I have not tried it because several PHP extensions are not ready to work in Apache multi-threaded mode, which AFAIK is the main advantage of using Apache 2.x instead of other Apache 1.x.
http://www.schroepl.net/projekte/mod_gzip/
--
Regards, Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html
-- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php