Menu

#4822 (ok 4.4.1) Compress when php.ini output_buffering is active

4.4.0
fixed
None
Low
2015-04-07
2015-03-31
No

It seems (JSON) output isn't (gzip) compressed. Could you enable compression to reduce transfer time?
For example, I see server_export.php has 1.6MB JSON output size..

Discussion

1 2 > >> (Page 1 of 2)
  • Madhura Jayaratne

    • assigned_to: Madhura Jayaratne
     
  • Madhura Jayaratne

    • assigned_to: Madhura Jayaratne --> nobody
     
  • Marc Delisle

    Marc Delisle - 2015-04-02

    Cannot reproduce in 4.4.0, if I enable compression via the custom export panel.

     
  • Olaf van der Spek

    Ah, this isn't about exporting data but about normal (AJAX) HTTP requests / responses.

     
    • Marc Delisle

      Marc Delisle - 2015-04-02

      Maybe I'm not familiar enough, but in Firebug I see that after a GET of server_export.php, the HTTP reply contains "Content-Encoding" set to "gzip" and "Content-Type" is "application/json".

       
  • Olaf van der Spek

    Hmm

    GET /pma/db_structure.php?server=1&db=tpt&token= HTTP/1.1
    Host: router
    Connection: keep-alive
    Authorization: Basic

    Accept: /
    X-Requested-With: XMLHttpRequest
    User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36
    Referer: http://router/pma/
    Accept-Encoding: gzip, deflate, sdch
    Accept-Language: en-US,en;q=0.8,nl;q=0.6
    Cookie: ***

    HTTP/1.1 200 OK
    Expires: Thu, 19 Nov 1981 08:52:00 GMT
    Last-Modified: Wed, 01 Apr 2015 16:30:44 GMT
    X-ob_mode: 0
    Cache-Control: no-cache
    Content-Type: application/json
    Transfer-Encoding: chunked
    Date: Thu, 02 Apr 2015 16:05:19 GMT
    Server: lighttpd/1.4.35

    fff8
    {"message":" ...

     
  • Olaf van der Spek

    Perhaps your web server takes care of the compression while mine (Lighttpd) doesn't. Should be taken care of in PHP (code) though.

     
    • Marc Delisle

      Marc Delisle - 2015-04-02

      What's the value of your $cfg['OBGzip'] setting?

       
  • Olaf van der Spek

    unset

     
  • Marc Delisle

    Marc Delisle - 2015-04-02

    Can you try with Firefox?

     
  • Marc Delisle

    Marc Delisle - 2015-04-02

    Also, what's your php.ini zlib.output_compression value?

     
  • Olaf van der Spek

    Isn't installed, but here's IE:

    GET /pma/phpmyadmin.css.php?server=1&token=X HTTP/1.1
    Accept: text/css, /
    Referer: http://router/pma/
    Accept-Language: nl-NL
    User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko
    Accept-Encoding: gzip, deflate
    Host: router
    DNT: 1
    Connection: Keep-Alive
    Cookie: pma_lang=en; pma_collation_connection=utf8_unicode_ci; phpMyAdmin=X
    Authorization: Basic X

    HTTP/1.1 200 OK
    Cache-Control: private, max-age=10800, pre-check=10800
    Last-Modified: Wed, 01 Apr 2015 16:30:44 GMT
    Content-Type: text/css; charset=UTF-8
    Expires: Thu, 02 Apr 2015 17:18:36 GMT
    Transfer-Encoding: chunked
    Date: Thu, 02 Apr 2015 16:18:36 GMT
    Server: lighttpd/1.4.35

     
  • Olaf van der Spek

    zlib.output_compression = Off (default AFAIK)

     
  • Marc Delisle

    Marc Delisle - 2015-04-02
    • assigned_to: Marc Delisle --> nobody
     
  • Marc Delisle

    Marc Delisle - 2015-04-02

    phpMyAdmin concludes that output buffering is not possible, as we can see in "X-ob_mode: 0". A possible reason is php.ini's value of output_handler set to "ob_gzhandler".

     
  • Olaf van der Spek

    That's not set either:

    ;output_handler =

     
  • Marc Delisle

    Marc Delisle - 2015-04-02

    Looking in libraries/OutputBuffering.class.php in _getMode(), a few simple conditions are checked. I believe that the only one to verify is this: does the ob_start() function exist on your server?

     
  • Olaf van der Spek

    ob_get_level() returns 1, perhaps due to output_buffering = 4096 (default).

     
    • Marc Delisle

      Marc Delisle - 2015-04-02

      According to http://php.net/manual/en/ini.list.php the default value of output_buffering is 0. In my environment, this setting is not defined.

       
  • Olaf van der Spek

    Debian has:
    ; Output buffering is a mechanism for controlling how much output data
    ; (excluding headers and cookies) PHP should keep internally before pushing that
    ; data to the client. If your application's output exceeds this setting, PHP
    ; will send that data in chunks of roughly the size you specify.
    ; Turning on this setting and managing its maximum buffer size can yield some
    ; interesting side-effects depending on your application and web server.
    ; You may be able to send headers and cookies after you've already sent output
    ; through print or echo. You also may see performance benefits if your server is
    ; emitting less packets due to buffered output versus PHP streaming the output
    ; as it gets it. On production servers, 4096 bytes is a good setting for performance
    ; reasons.
    ; Note: Output buffering can also be controlled via Output Buffering Control
    ; functions.
    ; Possible Values:
    ; On = Enabled and buffer is unlimited. (Use with caution)
    ; Off = Disabled
    ; Integer = Enables the buffer and sets its maximum size in bytes.
    ; Note: This directive is hardcoded to Off for the CLI SAPI
    ; Default Value: Off
    ; Development Value: 4096
    ; Production Value: 4096
    ; http://php.net/output-buffering
    output_buffering = 4096

    I wonder what the correct and portable way to do gzip compression for PHP is.

     
  • Marc Delisle

    Marc Delisle - 2015-04-02

    How about this patch?

     
  • Olaf van der Spek

    Looks good, though CSS and JS don't get compressed.

     
  • Marc Delisle

    Marc Delisle - 2015-04-02
    • summary: Compress (JSON) output --> Compress when php.ini output_buffering is active
     
  • Marc Delisle

    Marc Delisle - 2015-04-02
    • summary: Compress when php.ini output_buffering is active --> (ok 4.4.1) Compress when php.ini output_buffering is active
    • status: open --> resolved
    • Priority: Normal --> Low
     
1 2 > >> (Page 1 of 2)
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.