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 8276809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T08:29:25+00:00 2026-06-08T08:29:25+00:00

How can we handle compression in both? Whose responsibility is it? Which one is

  • 0

How can we handle compression in both? Whose responsibility is it? Which one is better, using apache or php to compress files?
PHP compression code:

ob_start("ob_gzhandler");

Or the apache one:

AddOutputFilterByType DEFLATE text/html text/plain text/xml 

Is this right that requests first reach in apache then to PHP? If answer is positive so can we infer that we should use the apache one?

  • 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-06-08T08:29:27+00:00Added an answer on June 8, 2026 at 8:29 am

    Well here is what I know, presented in a pros and cons way.
    Apache:

    • The .htaccess code will always be executed faster, because servers
      cache .htaccess files by default.
    • With .htaccess, you can define custom rules for individual folders
      and the server will automatically pick them up
    • With PHP, you cannot write everything in once place. There are
      many other things your .htaccess should have, besides compression:

    • A charset, expiry/cache control, most likely a few URL re-write
      rules, permissions, robot(Googlebot etc) specific stuff.

    As far as I know, you cannot do all of this solely with PHP, and since you may need to get all of this done, I don’t see why you should combine both of them.
    I have always relied on .htaccess or server level configuration to control the above enumerated aspects, and rarely ever had a problem.

    PHP:

    • perhaps a bit more hassle free. With .htaccess files on shared hosting planes you are rather limited and you might run into tedious
      problems.
    • Some servers won’t pick up certain commands, some(like 1and1) have a
      default configuration which messes with your settings(and nerves).
    • probably easier to use for someone who is less of a tech person

    Overall, Apache is the winner. That’s what I would go with all the time!

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

Sidebar

Related Questions

Imagine you have a server which can handle only one client at a time.
I was wondering how you can handle files with variables in the url like
I need a data structure which can handle the following: date_from (datetime) date_to (datetime)
It is my understanding that one can handle events through Swing by adding a
I'm currently using PHP to include multiple css (or js) files into a single
Need a makefile dependency rule that can handle missing files gives some pointers on
Can anyone suggest a plugin which can handle text selections in text areas (cross
I have multiple superposed controls which can handle a mouse click under certain conditions.
we are deflating the php files for compression, performance, etc. the .htaccess file syntax
Is there anyway I can handle both json and html return types when posting

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.