Php X-SendFile在centos上不工作
我在6美分上安装了以下内容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
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"');
}
?>