Jump to content

GZIP compression


Xerxes1

Recommended Posts

I get the following error when I include GZIP compression...

 

Parse error: syntax error, unexpected T_DNUMBER in /home/oni/public_html/0niCMS/turbo/header.php on line 5

 

<?php
//gzip compression
$phpver = phpversion();
$useragent = (isset($_SERVER["HTTP_USER_AGENT"]) ) ? $_SERVER["HTTP_USER_AGENT"] : $HTTP_USER_AGENT;
if ( $phpver >= ‘4.0.4pl1? && ( strstr($useragent,’compatible’) || strstr($useragent,’Gecko’) ) ) {
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’) ) {
$do_gzip_compress = true;
ob_start();
ob_implicit_flush(0);
header(’Content-Encoding: gzip’);
}
}
}
?>

Link to comment
https://forums.phpfreaks.com/topic/139425-gzip-compression/
Share on other sites

You are not using standard quotation marks.  Are you using Microsoft Word to edit code?

 

lrn2compooter u say? :P

 

I have changed the script to have normal ' marks instead of the other ones, however the error still occurs :(

 

<?php
//gzip compression 
$phpver = phpversion();
$useragent = (isset($_SERVER["HTTP_USER_AGENT"]) ) ? $_SERVER["HTTP_USER_AGENT"] : $HTTP_USER_AGENT;
if ( $phpver >= '4.0.4pl1? && ( strstr($useragent,'compatible') || strstr($useragent,'Gecko') ) ) {
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') ) {
$do_gzip_compress = true;
ob_start();
ob_implicit_flush(0);
header('Content-Encoding: gzip');
}
}
}
?>

Link to comment
https://forums.phpfreaks.com/topic/139425-gzip-compression/#findComment-729525
Share on other sites

  • 2 months later...

cannot get GZIP to work, at least according to zen cart..

 

The pre-install test tells me that:

 

PHP Output Buffering (gzip) = OFF

 

Does anyone know what I might need to change in order to enable this?

 

here's my phpinfo...    http://www.puertoricoautoforo.com/phpinfo.php

Link to comment
https://forums.phpfreaks.com/topic/139425-gzip-compression/#findComment-787682
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.