zlib.output_compression, Specifically for PHP-MySQL Web Software Like WordPress Should Be Off on Cloud Server for Performance. Here is Why. zlib.output_compression can be set from php.ini file; indeed we were talking about Optimize php ini for Rackspace Cloud Server (PVHVM), the readers already know about the way to find this php.ini file.
But before we begin, let us joke a bit with spam master Matt Cutts’ blog’s page loading speed. His website loads at amazing speed, if you are this website or your website runs faster, you are wrong. Without any Ads, images (he knows the quality of Google’s CDN, pun intended for CDN part), you can see the test results here :
High speed, right? If you do not want such 52/100 score; you need to have curiousness about these things we are talking about. By the way, do not think that his score is great on even Google Page Speed test. Actually Google will go away with time, people are becoming aware of PRISM, Heartbleed; the relationships – AOL possibly was better. Content will remain.
zlib.output_compression Should Be Off on Cloud Server
It is important to understand that – we are not optimizing websites for Google, we are doing it for usability. You can test – Facebook has best of the best server configuration. zlib.output_compression enables gzip. Technically we should set to on, right? Here is official documentation on zlib.output_compression :
But in most CMS including WordPress; usually cache modules or cache plugins like W3 Total Cache will throw a message :
Either the PHP configuration, web server configuration or a script in the WordPress installation has zlib.output_compression enabled.
Please locate and disable this setting to ensure proper HTTP compression behavior.
Like this :
zlib.output_compression Should Be Off on Cloud Server as we use Apache’s mod_deflate. This PHP’s zlib.output_compression is based on Apache’s mod_deflate. As the Plugins generates static HTML files; mod_deflate effectively compress them. PHP’s zlib output_compression will only work files passed through the PHP handler (i.e. .php files), but Apache’s mod_deflate can work on any files (e.g. static CSS or JS). Here is mod_deflate :
In case of our multiple server setup, it is quite dangerous keep it on. By default it is set to Off. Everytime PHP prints something, without OB it would be sent straight to apache and from apache to the browser. Instead, with OB, the output stops at Apache and waits until the data is flushed (to the browser) or until the script ends and the data is flushed automatically. This saves quite a lot of time and resources when generating a page by buffering the Apache to Web Browser stage of the process.
Why would you make PHP compress it in case of Single Server? What you “should” do to drastically free Apache to process PHP is to install NGINX as a front to the public. It’s VERY easy to setup as a reverse proxy and you can even install it on the SAME server as php and apache.
So set NGINX on port 80, put Apache on say port 8080 (and only allow nginx to connect, but don’t worry if you leave it public for a little time as it was already public and great for debugging to bypass nginx so no security issues should rise – but we recommend you not to leave it public for to long). Then make nginx reverse proxy to Apache, cache all static files which offloads that from apache (because nginx serves them instead) meaning apache can do more php requests, and also get nginx to perform OUTPUT COMPRESSION) freeing up apache and php to do even more requests. As an added benefit, nginx can also serve static files much faster than Apache and Nginx also uses much less ram and can handle much more connections.
Remember to KEEP output buffering ON however for PHP to Apache but turn zlib.output_compression OFF on PHP and enable it instead on nginx.
Turn Off zlib.output_compression
Like we have said in the guide Optimize php ini for Rackspace Cloud Server (PVHVM); first SSH to your server and then fun this command :
php -i | grep 'php.ini'
Then edit the file :
# change /path/to/php/cli/
You should use ^ + W to find zlib.output and set it too Off.
Follow the Author of this article :