title: How to compress JSON with PHP?
body: <p>I'm writing a little analysis page which will help me hunt down bugs in an application. In essence it allows to visually compare actual data and log entries, plus perform a bit of analysis on the data.</p>
  
  <p>Since this is for debugging only and since I will be deploying this on the live site I want it to have as little server load as possible. Several of the analysis options will include rather heavy substring searching or n<sup>2</sup> operations, so I'm going to offload this to the client.</p>
  
  <p>This means that the PHP page will just take the data from the tables and logs, JSON some of it, and write it out. The client Javascript will then do all the analysis etc.</p>
  
  <p>The problem is that the JSON'ed data will be several MB large, and my connection to the server - slow. It would be nice to compress the data somehow. Anyone have ideas?</p>
  
  <p>The environment is PHP + Apache; I don't know if mod_gzip will be installed; and I have no control over it.</p>