How do I make my site pages display faster?
The answer is zlib output compression.
Enabling the zlib output compression can speed up the load times considerably(up to 7x and more), particularly on pages which are comprised mostly of html code without pictures (as is the case with most pages generated by pmwiki)
These directions apply for Apache servers with PHP, and the zlib compression module installed, which is the case with the majority of the servers.
To enable the compression , you just have to add the following 2 lines to the .htaccess file which resides in the www directory of the server. If there is no such file, create it:
php_flag zlib.output_compression on php_value zlib.output_compression_level 2
That's it. Providing the server supports it, you should now experience considerable diference in how fast the pages are displayed.
In order to check whether the compression works and see the compression ratio visit this page: http://www.port80software.com/products/httpzip/compresscheck or http://www.gidnetwork.com/tools/gzip-test.php .
If the server displays an error message after you added those 2 lines then your server doesn't support it in this simple way. In this case remove the above 2 lines from the .htaccess file and upload the file again. Ask your server administrator if he can enable the compression.
The method described in Cookbook-V1/ReduceBandWidth still works for pmwiki version 2.
Depending on the compilation of php on your host (PHP compiled with "--with-zlib") this might be as easy as adding:
To prevent conflicts if zlib is already activated, and since using zlib.output_compression is preferred over ob_gzhandler() better use the following variant:
if ( !@ini_set('zlib.output_compression',TRUE) && !@ini_set('zlib.output_compression_level',2)) ob_start('ob_gzhandler');
Notes and Comments
Tried both methods on my Linux server. The first resulted in an Internal Server Error (without further comments). The second apparently works.
On my linux-hosted site, method one also gave an Internal Server Error. Method two did not, but the websites about show the same results for before/after. So I would say it isn't working.
Anno May 08, 2005, at 06:22 AM
Pages linking to this page: