Mod_xsendfile "Page not found"

software development


I am using php and xsendfile to serve some large (25-50mb) files.

I have xsendfile enabled and am using the code

[php]header(‘X-Sendfile: "’.$fullPath.’"’);[/php]

where $fullPath is the (derp) full path to the file… starting with /home/username/blahblah…

Using php’s readfile, this finds the file fine, but is not a viable solution because of the size of the files.

When using xsendfile, the header is sent, but the file is not being found for some reason. I am only getting a webpage not found error.

Any help?


Remove the double quotation marks on the file name. They aren’t part of the filename, so they shouldn’t be in the header.


My god I feel like an idiot. Got it from an example online, so I assumed it was correct.

Thank you so much, that solved it!


One very depressing thing about programming tutorials online is that, for every correct example, there are probably a few dozen poorly written, outdated, or simply wrong examples. Oh, and you’ll probably find all the bad ones first. :frowning: