• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

zlib? gzip?

crj

New Member
how do i use zlib or gzip to compress php scripts on my site?

do i put something inside htaccess or something?
 
Originally posted by crj
how do i use zlib or gzip to compress php scripts on my site?

do i put something inside htaccess or something?

is it running on ur machine or sum1 else
 
> how do i use zlib or gzip to compress php scripts on my site?

Put this at the top of your (php) scripts and, if your server supports zlib/gzip...

Code:
<?php
$phpver = phpversion();
if($phpver >= '4.0.4pl1')
{
	if(extension_loaded('zlib'))
	{
		ob_start('ob_gzhandler');
	}
}
else if($phpver > '4.0')
{
	if(strstr($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip'))
	{
		if(extension_loaded('zlib'))
		{
			ob_start();
			ob_implicit_flush(0);
			header('Content-Encoding: gzip');
		}
	}
}
?>
 
Back
Top