Welcome Guest, Not a member yet? Register   Sign In
Codeigniter gzip problem
#1

[eluser]Unknown[/eluser]
I have some controller:
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

    class Somecontroller extends CI_Controller
    {
        function svg($id)
        {
                $img = file_get_contents("/some_path/".(int)$id.".svg");
                header("Content-type: image/svg+xml");
                echo $img;
                /*$this->output
                        ->set_content_type('image/svg+xml')
                        ->set_output($img);*/
        }
    }
It worked on the old hosting(PHP Version 5.3.X) and it works on my local web server(PHP Version 5.4.9). But it does not work on new hosting(PHP Version 5.4.4-14), I get an error in chrome:
Quote:This page contains the following errors:

error on line 1653 at column 1: Encoding error
Below is a rendering of the page up to the first error.

Line 1653 is empty. All files encoding UTF-8.
I turned off gzip compression in the browser and it worked. But this is not the way. I turned back gzip compression.
Then I tried to echo the image without CI. I created somefile.php with code:
Code:
<?php
$img = file_get_contents("/some_path/" . $_GET['file']);
header("Content-type: image/svg+xml");
echo $img;
?>
It works fine.

Does anyone have any idea what is wrong with CI? Or with hosting?




Theme © iAndrew 2016 - Forum software by © MyBB