为php脚本启用GZIP压缩

I've enabled gzip on my php scripts by doing this:

<? ob_start("ob_gzhandler"); 
?>
<?php
header('Content-Type: application/json');
header('Accept-Encoding: gzip');

/* Request data, transform it, json_encode it, echo */

?>
<? ob_flush(); ?>

This has been working on a couple of hosts, but when I moved to Hosting24, it simply wont work.

I have also enabled 'Compress all content' in cPanel's optimize website section, along with editing the .htaccess file to something like this: https://stackoverflow.com/a/8262235/2237587

Hosting24 has assured me of this:

Our servers support mod_gzip, mod_deflate by default. 

To use GZIP, please call the function ob_start("ob_gzhandler"); at the top of your script. Also remember to call the function ob_flush(); at end

I am doing this, but it does not work for Hosting24. When I use the same script on another service (tested on 000webhost and Arvixe), the response is compressed.

What can I try next to get it compressed, to be honest I have no idea why it's not working already.

Replacing this:

header('Content-Type: application/json');

with

header('Content-Type: text/javascript');

fixed the problem. Not sure if this is a problem with Hosting24 or not. text/javascript allows me to use the json request of AFNetworking still so i'm happy with result.