【问题标题】:x-sendfile activation in apache2apache2中的x-sendfile激活
【发布时间】:2017-09-12 01:56:48
【问题描述】:

我有 microsoft windows server iis 7,我已经在上面安装了 apache2 x-sendfile 插件安装在 apache 上,但是当我通过以下代码对其进行测试时

if (in_array('mod_xsendfile', $modules)) {
// If mod_xsendfile is loaded, use X-Sendfile to deliver.. (optional: I have this as failover to use PHP readfile() if mod_xsendfile is unavailable)
header ('X-Sendfile: ' . $pathToFile);
header ('Content-Type: ' . $documentMIME);
header ('Content-Disposition: attachment; filename="' . $actualFilename . '"');
exit;}

什么都没发生!!! 有什么问题?

【问题讨论】:

  • $modules 是如何填充的?可以通过phpinfo()查看mod_xsendfile是否加载; - 如果存在,它会列在“加载的模块”下。您是否在 httpd.conf 中启用了 x-sendfile? LoadModule xsendfile_module modules/mod_xsendfile.so<IfModule xsendfile_module> XSendFile on </IfModule> 都需要在场吗?
  • 谢谢,问题解决了!!! xD

标签: php apache2 x-sendfile


【解决方案1】:

mod_xsendfile 的作者本人已经在这里回答了一些问题: mod_xsendfile for Win x64?

我假设您使用的是 Windows 64 位和 Windows 7。他说没有为此构建,尽管该线程中的其他人可以正常工作。我会通读他们的 cmets/回复。安装并确保修改 httpd 文件以正确加载它。祝你好运。

【讨论】: