[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 939
  • Last Modified:

invalid form of compression php

Content Encoding Error

The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression.

there are folders of smarty templates

i am using a cms
<?php
define('_VALID', true);
require 'include/config.php';
require 'include/function_global.php';
require 'include/function_smarty.php';


$sql_add	= NULL;
$sql_delim	= ' WHERE';
if ( $config['show_private_videos'] == '0' ) {
    $sql_add   .= $sql_delim. " type = 'public'";
    $sql_delim	= ' AND';
}

$sql_add       .= $sql_delim. " active = '1'";  

$sql            = "SELECT VID, title, duration, addtime, thumb, viewnumber, rate, type
                   FROM video" .$sql_add. " ORDER BY viewtime DESC LIMIT " .$config['watched_per_page'];
$rs             = $conn->execute($sql);
$viewed_videos  = $rs->getrows();
$viewed_total   = count($viewed_videos);
$sql            = "SELECT VID, title, duration, addtime, thumb, viewnumber, rate, type
                   FROM video" .$sql_add. " ORDER BY addtime DESC LIMIT " .$config['recent_per_page'];
$rs             = $conn->execute($sql);
$recent_videos  = $rs->getrows();

$smarty->assign('errors',$errors);
$smarty->assign('messages',$messages);
$smarty->assign('menu', 'home');
$smarty->assign('index', true);
$smarty->assign('viewed_total', $viewed_total);
$smarty->assign('viewed_videos', $viewed_videos);
$smarty->assign('recent_videos', $recent_videos);
$smarty->assign('self_title', $seo['index_title']);
$smarty->assign('self_description', $seo['index_desc']);
$smarty->assign('self_keywords', $seo['index_keywords']);
$smarty->display('header.tpl');
$smarty->display('errors.tpl');
$smarty->display('messages.tpl');
$smarty->display('index.tpl');
$smarty->display('footer.tpl');
$smarty->gzip_encode();
?>

Open in new window

0
rgb192
Asked:
rgb192
1 Solution
 
SimonJ621Commented:
Try clearing your cache.
0
 
jagdishshirsatCommented:
hi,

The code is using gzip compression. ( see last line $smarty->gzip_encode();)

Disable the Gzip compression and your pages will work.
See if there is setting in your admin control panel to disable Gzip compression.


Thanks
0
 
jagdishshirsatCommented:
I mean to say your website admin section.

Thanks
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
InsoftserviceCommented:
0
 
rgb192Author Commented:
<?php ob_start("ob_gzhandler"); ?>

3) The end_gzip.php file:

<?php ob_flush(); ?>


should i place this in php file

how could i disable gzip just to test if my file is running


i am using a cms (content managment system)
could some files be zipped
and i have to unzip them to read


0
 
rgb192Author Commented:
also
do i have to make changes in htaccess file


i may not be able to make htaccess file changes

i dont think i have access to htaccess
0
 
jagdishshirsatCommented:
Hi,

You are getting the error because Gzip compression is applied. The code given by "insoftservice:" is to apply gzip compression. This would not help you out

Instead you have to remove/disable the gzip compression to get your site working.

For this: Please login to your website admin section (Admin section of your CMS) and search for the setting where you can disable the Gzip compression.

If you are not able to locate the settings in admin section; then search for the two lines of code
<?php ob_start("ob_gzhandler"); ?>
and
<?php ob_flush(); ?>
and comment these out.

But this is not the right way; if you can find the setting in administration section; it would automatically do the job for you.

Thanks


Thanks
0
 
rgb192Author Commented:
are there some files that need to be UN-GZIPED to be displayed on a browser

is there a setting in php.ini that UN-GZIPS a file
0
 
jagdishshirsatCommented:
Hi,

Nope. Gzip compresses your files on the fly (before transferring the data to browser over Http). The browser that supports Gzip encoded data can decode those contents and renders it.

If the browser does not support Gzip encoding it throws an error; invalid form of compression.

I think your question is resolved?

Thanks

0
 
rgb192Author Commented:
thanks
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now