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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:43:37+00:00 2026-06-06T13:43:37+00:00

In asking around and doing some research, it seems like many people are really

  • 0

In asking around and doing some research, it seems like many people are really pushing X-Sendfile as the preferred method of serving large downloadable files to a browser-based client from a PHP script.

Some methods I’ve been looking into are:

  • Streaming fopen
  • Streaming cURL
  • file_get_contents
  • cURL
  • X-Sendfile

Of these, most people are telling me that X-Sendfile is the best.

The problem is, I am trying to implement a download method that is not only capable of handling large files, but also widely universal on most servers, since the script I am writing will be used by many other servers than just my own.

My question is: What makes X-Sendfile so much better? If it’s so good, why don’t I hear a lot about it and why isn’t it being used more often? Lastly, will most typical low-budget shared web hosts support X-Sendfile?

Thanks!

  • 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-06T13:43:39+00:00Added an answer on June 6, 2026 at 1:43 pm

    It allows the webserver to send the file in whatever it thinks is the best way to send that file to the client. It also enables support for range requests (i.e. download managers and resuming) as long as the webserver supports it without writing a single line of code for it.

    However, “typical low-budged shared web hosts” are unlikely to support it. Consider if you really want to target them though; that usually also involves supporting outdated PHP versions, nasty configurations (safe_mode and/or magic_quotes enabled) and lack of PHP modules such as PDO (always enabled in recent PHP versions, but see one of my previous points).

    Any other way of sending files to the client has the disadvantage that PHP needs to read it and then pass it to the webserver as string data (which is not efficient compared to e.g. letting the kernel write a whole file to a socket). When using file_get_contents it is even worse – you read the whole file into memory which is not necessary at all.

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

Sidebar

Related Questions

After doing some asking around and reading, it sounds like you're lucky to get
I'm learning Java and find myself sending methods around while asking for help but
I can't get around a peculiar problem with SimpleOpenNI for Processing ao I'm asking
Okay, I just can't get my head around multi-threading scenarios properly. Sorry for asking
So I know that you can wrap a function around another function by doing
I hate asking questions like this - they're so undefined... and undefinable, but here
I'm starting to feel like it is something i'm doing something wrong since I
Ok, I know this sounds really daft to be asking here, but it is
I'm asking this question here because after looking around the web for answers, I
I hope I'm asking this in the right way. I'm learning my way around

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.