I am trying to send files by using X-Sendfile directive in lighttpd.
My php code is;
header("Content-Type: application/force-download");
header( "Content-Disposition: attachment; filename=" . 's.php');
header("Content-Length: ". filesize("/home/web/domain/htdocs/download.php"));
header( "X-Sendfile: /home/web/domain/htdocs/download.php");
(I am sending download.php file just for testing purpose)
However, I get blank file no matter what I try. If I change the filename, I get;
2010-08-30 18:01:14: (mod_fastcgi.c.2587) send-file error: couldn't get stat_cache entry for: /home/web/domain/htdocs/downloa1d.php
So, it is working, but when I send the correct file it does not give any error in the logs and the browser downloads an empty file.
What could be wrong? What should I do?
.php
file is supposed to actually stream the contents of the file (and not execute it), right? Also, check the docs. It'sX-LIGHTTPD-send_file
sinceX-Sendfile
is only supported by 1.5+ (which isn't stable, unless you're running bleeding edge). Also realize that the code you give, and the error you give conflict (They have different paths)... – Slicerstatic-file.exclude-extensions
setting – Slicer