rregister

Member
Aug 10, 2015
12
0
1
Texas
cPanel Access Level
Root Administrator
I'm having trouble getting compression working on a VPS server for a client. I've enabled "compress all content" from inside the individual account cpanel. I can confirm that this is properly adding the following code to the .htaccess file in the account root.

Code:
<IfModule mod_deflate.c>
    SetOutputFilter DEFLATE
    <IfModule mod_setenvif.c>
        # Netscape 4.x has some problems...
        BrowserMatch ^Mozilla/4 gzip-only-text/html
       
        # Netscape 4.06-4.08 have some more problems
        BrowserMatch ^Mozilla/4\.0[678] no-gzip
       
        # MSIE masquerades as Netscape, but it is fine
        # BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
       
        # NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
        # the above regex won't work. You can use the following
        # workaround to get the desired effect:
        BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
       
        # Don't compress images
        SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary
    </IfModule>
   
    <IfModule mod_headers.c>
        # Make sure proxies don't deliver the wrong content
        Header append Vary User-Agent env=!dont-vary
    </IfModule>
</IfModule>
Under "Tweak settings" > "Compression", I have the default settings.

I can also confirm that the package "ea-apache24-mod_deflate" is installed in my current easyapache 4 config.

I'm little puzzled because I've never encountered this issue before... it always just worked out of the box. Any advice would be appreciated!
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,911
2,234
363
I'm having trouble getting compression working on a VPS server for a client. I've enabled "compress all content" from inside the individual account cpanel. I can confirm that this is properly adding the following code to the .htaccess file in the account root.
Hello,

You can use the following command after uploading a test file to the domain name to verify if the content is compressed:

Code:
curl -v --compressed http://www.test.domain/test.html
Could you run this command and let us know the output?

Thank you.
 

rregister

Member
Aug 10, 2015
12
0
1
Texas
cPanel Access Level
Root Administrator
Hello,

You can use the following command after uploading a test file to the domain name to verify if the content is compressed:

Code:
curl -v --compressed http://www.test.domain/test.html
Could you run this command and let us know the output?

Thank you.
Code:
> GET /test.html HTTP/1.1
> Host: [intentionally excluded]
> User-Agent: curl/7.43.0
> Accept: */*
> Accept-Encoding: deflate, gzip
>
< HTTP/1.1 200 OK
< Date: Wed, 07 Sep 2016 18:15:53 GMT
< Server: Apache
< Last-Modified: Wed, 07 Sep 2016 18:14:31 GMT
< Accept-Ranges: bytes
< Content-Length: 26
< Vary: User-Agent
< Cache-Control: max-age=31536050
< Content-Type: text/html
I initially noticed the problem when using google's pagespeed test, but I've also used sites like http://www.whatsmyip.org/http-compression-test and they return the same result . Thanks for your help!
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,911
2,234
363
Could you open a support ticket using the link in my signature so we can take a closer look? You can post the ticket number here so we can update this thread with the outcome.

Thank you.
 

rregister

Member
Aug 10, 2015
12
0
1
Texas
cPanel Access Level
Root Administrator
Thanks for the quick response, Michael.

Support Request ID is: 7653411
Issue resolved. For anyone wondering, because I used easyapache4 with muti php, I needed to add

Code:
output_handler = Off
zlib.output_compression = On
zlib.output_handler = ob_gzhandler
to the specific php.ini file (in my case php7). Just enabling compression was not enough to get it working with php files.
 

Jaison V John

Member
Apr 15, 2016
17
3
3
India
cPanel Access Level
Root Administrator
Issue resolved. For anyone wondering, because I used easyapache4 with muti php, I needed to add

Code:
output_handler = Off
zlib.output_compression = On
zlib.output_handler = ob_gzhandler
to the specific php.ini file (in my case php7). Just enabling compression was not enough to get it working with php files.
----------------------------------

@cPanelMichael ==> Is there any ETA for this bug in the recent cPanel versions?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,911
2,234
363
Hello @Jaison V John,

Internal case EA-5367 is still open, however there's no specific time frame on it's release date. Adding those entries to the specific php.ini file utilized by the domain name is still required at this time. The case is scheduled for an additional look once the work to ensure all PHP INI editors offered in cPanel/WHM account for all PHP versions and handlers.

Thank you.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,911
2,234
363
Hello,

To update, cPanel version 68 will add the zlib.output_compression option to the MultiPHP INI Editor feature in cPanel and WHM. Additionally, a note in the "Optimize Website" feature within cPanel will direct users on how to enable the zlib.output_compression option for PHP.

Thank you.