You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Azure Linux Web App(PHP7.4)下载2MB以上文件失败

问题:Azure App Service Linux 大文件下载触发400错误

我们正将网站从小型服务商迁移至Azure,目前除下载2MB以上文件时会出现400错误外,其余业务流程均正常。

已尝试以下排查动作:

  • 调整php.ini相关配置
  • 在其他Azure Linux容器中复现测试,同样出现该问题
  • 检查Azure相关日志,未找到对应错误记录

以下是用于测试的PHP代码片段:

$file = "test.exe";
$quoted = sprintf('"%s"', addcslashes(basename($file), '"\\'));
$size   = filesize($file);

header('Content-Description: File Transfer');
header('Content-Type: application/*');
header('Content-Disposition: attachment; filename=' . $quoted); 
header('Content-Transfer-Encoding: binary');
header('Connection: Keep-Alive');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . $size);    

readfile($file);

我们对比了旧服务器的PHP和Apache配置,二者几乎一致,请问遗漏了什么关键配置?


内容的提问来源于stack exchange,提问作者Marcin

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.19 22:15:34