I've been strongly suggested to make use of XSendfile since we're serving quite large files from your server. The server is running Cpanel. Formerly i was utilizing a straight pressure-download script, that also didn't work nicely in certain browsers. Wishing to kill two wild birds with one stone with XSendfile.

So, our host has allowed Xsendfile on our server. I authored a fast test script:

$file = "/home/deli/central/testfile.doc";
header("X-Sendfile: $file");
header("Content-type: application/octet-stream");
header('Content-Disposition: attachment; filename="' . basename($file) . '"');
exit;

After I run this, I recieve the download prompt. However the file that's sent is definitely 0kb.

A little of research, appears you have to setup something more important either in the apache config file, or perhaps an htaccess file. I had been also told that it's not recommended to combine it with the apache config, else it might get overwritten with an update. I'd rather get it done in htaccess ayway, since i have do not have direct accessibility apache config and that i prefer to possess the control that doing the work with htaccess should offer.

Basically could possibly get results, obviously.

So, I have added the next for an htaccess file:

XSendFile on XSendFilePath /home/deli/central XSendFileAllowAbove On

(The relative path in the script towards the central file directory is ../../deli/central)

Basically add wrinkles towards the htaccess, and set it within the public_html directory (same directory because the test script), after i then run the exam script I recieve a 500 error. Quick consider the error logs shows:

/home/north/public_html/.htaccess: XSendFilePath not permitted here

Could anybody enlighten me regarding anything I would do wrong?

ps - Someone said that it's a lot more efficient to get it done within the apache config, therefore the server isn't needing to crawl through and load all htaccess files. Have no idea if this sounds like true or otherwise.

Assistance is greatly appreciated, this really is a little of the showstopper around the project :)

ps I didn't remember to say - basically include a straight pressure-download in to the script, utilizing the same $file path, the file downloads all right. Therefore the path would appear to become correct.

If you're getting bytes it may be output compression needs disabled,see here for more. For that XSendFilePath not permitted here error that's a syntax trouble with your .htaccess. Check it by hand if you're able to to make sure it is in the best place per the documentation.