X-发送文件错误 [英] X-Sendfile Error
问题描述
我试图在lighttpd中使用X-Sendfile指令发送文件.
I am trying to send files by using X-Sendfile directive in lighttpd.
我的php代码是;
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");
(我仅出于测试目的而发送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)发送文件错误:无法获得stat_cache条目用于/home/web/domain/htdocs/downloa1d.php
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?
推荐答案
好,这是一篇旧文章,但是我还是要回复,因为我在这个问题上停留了太长时间了,但是我没有找到我的解决方案随处可见,所以我去了:
ok this is an old post, but I'm going to reply anyway 'cause I was stuck on this too for way too long and I didn't find my solution anywhere so here I go:
是的,我编辑了lighttpd.conf并添加了
Yeah I edited lighttpd.conf and added
fastcgi.server += ( ".php" => (( "allow-x-send-file" => "enable" )) )
并已使用
Header("X-LIGHTTPD-send-file: /path/filename");
在php测试页中.但这没有用.我花了一段时间才弄清楚我在
in the php test page. But it didn't work. It took me a while to figure out I also had a php definition in
etc/lighttpd/conf-enabled/15-fastcgi-php.conf
在其中添加选项后,它就起作用了:)
After I added the option in there it worked :)
这篇关于X-发送文件错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!