Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/234.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php X-SendFile在centos上不工作_Php_X Sendfile - Fatal编程技术网

Php X-SendFile在centos上不工作

Php X-SendFile在centos上不工作,php,x-sendfile,Php,X Sendfile,我在6美分上安装了以下内容 apache version :Apache 2.0 httpd-tools-2.2.15-28.el6.centos.x86_64 httpd-devel-2.2.15-28.el6.centos.x86_64 httpd-2.2.15-28.el6.centos.x86_64 . 在httpd.conf中,我添加了一行: LoadModule xsendfile_module/usr/lib64/httpd/modules/module_xsendfile.so

我在6美分上安装了以下内容

apache version :Apache 2.0
httpd-tools-2.2.15-28.el6.centos.x86_64
httpd-devel-2.2.15-28.el6.centos.x86_64
httpd-2.2.15-28.el6.centos.x86_64 .
在httpd.conf中,我添加了一行: LoadModule xsendfile_module/usr/lib64/httpd/modules/module_xsendfile.so

和apache_get_模块();显示加载的mod数组中的modxsendfile。。。现在我有了.htaccess文件,其中包含

<Files files.php>
XSendFile on
</Files>

一切似乎都是正确的。但它仍然没有显示任何文件。

在您拥有的.htacess文件中

<Files files.php>
  XSendFile on
</Files>

上的XSendFile
而files.php是

<?php

 $file = "path_to_your_file";
 $finfo = new finfo;  
  $mime = $finfo->file($file, FILEINFO_MIME_TYPE );
 if (in_array('mod_xsendfile', apache_get_modules()))
 {
header("X-Sendfile: $file");
header("Content-type: $mime");
//header ('Content-Disposition: attachment; filename="image"'); 
 }

?>

#AllowOverride控制可以放入哪些指令。htaccess AllowOverride All。由于AllowOverride设置为“无”,因此无法正常工作
<?php

 $file = "path_to_your_file";
 $finfo = new finfo;  
  $mime = $finfo->file($file, FILEINFO_MIME_TYPE );
 if (in_array('mod_xsendfile', apache_get_modules()))
 {
header("X-Sendfile: $file");
header("Content-type: $mime");
//header ('Content-Disposition: attachment; filename="image"'); 
 }

?>