Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/275.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如果文件大小超过4G,则它可以';不能下载_Php_Apache_.htaccess_X Sendfile - Fatal编程技术网

Php X-Sendfile如果文件大小超过4G,则它可以';不能下载

Php X-Sendfile如果文件大小超过4G,则它可以';不能下载,php,apache,.htaccess,x-sendfile,Php,Apache,.htaccess,X Sendfile,我在PHP()中使用了临时链接脚本,它工作得很好,但问题是临时链接是不可恢复的,而且如果文件大小超过4G,就无法下载。 为了解决这个问题,我使用了X-Sendfile,并对其进行如下配置=> apt get安装libapache2 mod xsendfile 将以下代码添加到.htaccess文件 上的XSendFile SetEnv MOD_X_SENDFILE_已启用1 使用以下代码 但它不起作用, 当我想在4G后下载16G的文件时,下载会失败,你知道吗???需要检查两件事:

我在PHP()中使用了临时链接脚本,它工作得很好,但问题是临时链接是不可恢复的,而且如果文件大小超过4G,就无法下载。 为了解决这个问题,我使用了X-Sendfile,并对其进行如下配置=>

  • apt get安装libapache2 mod xsendfile
  • 将以下代码添加到.htaccess文件

上的XSendFile
SetEnv MOD_X_SENDFILE_已启用1
  • 使用以下代码

但它不起作用, 当我想在4G后下载16G的文件时,下载会失败,你知道吗???

需要检查两件事:

  • 您的客户端可以处理大于4Gb的文件
  • 服务器是否在64位操作系统上运行?否则,报告的文件大小为 统计电话可能是错误的
<IfModule mod_xsendfile.c>
  <Files *.php>
    XSendFile On
    SetEnv MOD_X_SENDFILE_ENABLED 1
  </Files>
</IfModule>
  <?php
    //We want to force a download box with the filename hello.txt                   
    header('Content-Disposition: attachment;filename=hello.txt');  
    //File is located at data/hello.txt 
    header('X-Sendfile: data/hello.txt'); 
  ?>