<p>I can't seem to find much documentation on X-Sendfile or example code for PHP (there is some rails code).</p>

<p>Anyone used it before and would mind giving a quick snippet of code and a brief description?</p>

[{'answer_id': 80201, 'author': 'Don Neufeld', 'author_id': 13097, 'author_profile': 'https://Stackoverflow.com/users/13097', 'pm_score': 5, 'selected': False, 'text': '<p>X-Sendfile is an HTTP header, so you want something like this:</p>\n\n<pre><code>header("X-Sendfile: $filename");\n</code></pre>\n\n<p>Your web server picks it up if correctly configured.  Here\'s some more details:</p>\n\n<p><a href="http://www.jasny.net/articles/how-i-php-x-sendfile/" rel="noreferrer">http://www.jasny.net/articles/how-i-php-x-sendfile/</a></p>\n'}, {'answer_id': 80422, 'author': 'Garrett Albright', 'author_id': 11023, 'author_profile': 'https://Stackoverflow.com/users/11023', 'pm_score': 2, 'selected': False, 'text': '<p>If tweaking the web server configuration is not an option, consider PHP\'s standard <a href="http://us3.php.net/manual/en/function.readfile.php" rel="nofollow noreferrer">readfile() function</a>. It won\'t be quite as fast as sendfiling, but it will be more widely compatible. Also note that when doing this, you should also send a Content-Type header at the very least.</p>\n'}]
['https://Stackoverflow.com/questions/80186', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']