HEY! If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

High Speed!Want a quick hack to boost speed of your pages? There are two ways to accomplish this.

  • Login to your server as root or normal with sudo privileges.
    • open your php.ini with vi (command may vary depending on where your php.ini file is located)
    • vi /etc/php.ini

    • Find and uncomment (default is disabled), or add the following line:
    • zlib.output_compression = On

  • This method enhances every site/page using php on the server by sending compressed files to clients that support it.
  • The second method will affect only a single site and requires only access to your .htacess file.
    • open your .htacces file
    • add the following line
    • php_flag zlib.output_compression On

Update: I plan to do some testing on performance to see if this really does help. Just simple visual and file download tests show that it does to me but more data is needed, coming soon!
image credit

5 Responses to “Enhancing PHP speeds (Drupal and Wordpress too)”

  1. Jared Suttonon 24 Jun 2008 at 4:58 pm

    This could speed up or slow down your site depending on how your hosting environment is. For example, a box that has high CPU utilization may not benefit as much from this hack, as it takes more horsepower to compress the data before sending it to the client’s browser. However, if the network your on is busting at the seams, then this might give you a slight edge.

    Have you done any actual speed tests on your site before and after applying this?

  2. nullvariableon 24 Jun 2008 at 5:08 pm

    well on my site it seems to make a pretty big difference. I did not actually do any sort of imperical testing. I just tested the difference before and after. Dialup users would see a huge speed boost however since the size of files makes a much bigger difference. According to the benchmarking site that I use, just enabling gzip compression saved a dialup user 6-7 seconds. It reduced the total size of the home page from around 70k to less than 50k (this has changed since that test because I’ve made several changes to the design since.)

  3. somchaion 01 Jul 2008 at 11:03 pm

    Thank you very much on your comment at DP and point me to this technique, I will try on my site after the host upgrade the php version in next week.
    I never think of “Hallowen color” during design my web theme.

    By the way, all of my contents are html, is it work too?

  4. nullvariableon 01 Jul 2008 at 11:55 pm

    yes, this technique will compress text files. To my knowledge it doesn’t do anything with graphics

  5. Yemek Tariflerion 03 Jul 2008 at 12:30 pm

    Thanks for this. You was help me. Article who your writen was so important for me. Thanks again :) I am reading all articles in happily

Trackback URI | Comments RSS

Leave a Reply