Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 542127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:24:52+00:00 2026-05-13T10:24:52+00:00

Most sites want to compress their content to save on bandwidth. However, When it

  • 0

Most sites want to compress their content to save on bandwidth. However, When it comes to apache servers running PHP there are two ways to do it – with PHP or with apache. So which one is faster or easier on your server?

For example, in PHP I run the following function at the start of my pages to enable it:

/**
 * Gzip compress page output
 * Original function came from wordpress.org
 */
function gzip_compression() {

    //If no encoding was given - then it must not be able to accept gzip pages
    if( empty($_SERVER['HTTP_ACCEPT_ENCODING']) ) { return false; }

    //If zlib is not ALREADY compressing the page - and ob_gzhandler is set
    if (( ini_get('zlib.output_compression') == 'On'
        OR ini_get('zlib.output_compression_level') > 0 )
        OR ini_get('output_handler') == 'ob_gzhandler' ) {
        return false;
    }

    //Else if zlib is loaded start the compression.
    if ( extension_loaded( 'zlib' ) AND (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== FALSE) ) {
        ob_start('ob_gzhandler');
    }

}

The other option is to use Apache deflate or gzip (both which are very close). To enable them you can add something like this to your .htaccess file.

AddOutputFilterByType DEFLATE text/html text/plain text/xml application/x-httpd-php

Since PHP is a scripting language (which must be loaded by PHP) I would assume that the apache method would be 1) more stable and 2) faster. But assumptions don’t have much use in the real world.

After all, you would assume that with the huge financial backing windows has… uh, we won’t go there.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T10:24:52+00:00Added an answer on May 13, 2026 at 10:24 am

    We’re running… a lot of webservers, handling 60M/uniques/day. Normally this isn’t worth mentioning but your question seems based on experience.

    We run with doing it in apache. What comes out the other end is the same (or near enough so as to not to matter) regardless of the method you choose.

    We choose apache for few reasons:

    • Zero maintenance, we just turned it on. No one needs to maintain some case structure
    • Performance, in our tests servers where Apache did the work faired marginally better.
    • Apache will apply the output filter to everything, as opposed to just PHP. On some occasions there are other types of content being served on the same server, we’d like to compress our .css and .js

    One word of warning, some browsers or other applications purposefully mangle the client headers indicating that compression is supported. Some do this to ease their job in terms of client side security (think applications like norton internet security and such). You can either ignore this, or try to add in extra cases to re-write requests to look normal (the browsers do support it, the application or proxy just futzed it to make its own life easier).

    Alternatively, if you’re using the flush() command to send output to the browser earlier, and you’re applying compression you may need to pad the end of your string with whitespace to convince the server to send data early.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

On most sites on the register user part they want you to enter password
Most sites show the syntax as applying list-style to the <li> but I've seen
I keep hearing the statement on most programming related sites: Program to an interface
When doing larger sites in big business, you most probalbly work in a team
I have a webcrawler application. It successfully crawled most common and simple sites. Now
I'm running a site that allows users to make comments, and most of them
I'm developing sites using Wordpress and I want to use the lates version of
I'm browsing some news sites and most of them have the option of posting
I want to add a jump to form on one of my sites that
I want to implement a simple wiki. Most probably will be using Java on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.