zarpio
zarpio

Reputation: 7338

gzip with codeigniter

Is there anyway to gzip with codeigniter? If yes please share Library, plugin or helper... Thankyou!

Upvotes: 8

Views: 20329

Answers (2)

Usman Tufail
Usman Tufail

Reputation: 11

I had the same issue on my site, but now I've figured it out by applying these steps:

  1. Go to CI's config.php:
  2. Find this code: $config['compress_output']
  3. Change value from FALSE to TRUE:

$config['compress_output'] = TRUE;

Now you have to enable "zlib.output_compression" from your server's php.ini. You will not receive error on your front-end.

Upvotes: 0

Matthew
Matthew

Reputation: 15642

In your config file change compress_output to TRUE. I think it uses gzip.

There's also this disclaimer:

VERY IMPORTANT: If you are getting a blank page when compression is enabled it means you are prematurely outputting something to your browser. It could even be a line of whitespace at the end of one of your scripts. For compression to work, nothing can be sent before the output buffer is called by the output class. Do not "echo" any values with compression enabled.

Upvotes: 25

Related Questions