就我所尝试的而言,通常的解决方案都不适用于我的问题。我的问题是每次上传“大文件”(600 KB〜)时都会收到500错误,对于较小的图像,它可以正常工作。因此,即使使用这个(极端的).htaccess文件,它仍然会发生,是的,.htaccess已经启用:
upload_max_filesize = 100M
post_max_size = 100M
memory_limit = 128M
max_input_time = 6000
max_execution_time = 6000
那么,我查看日志并找到了这个(只有一行,为了易于阅读,将其粘贴在此):
[Mon Jul 27 17:09:28.<port> 2015] [:error] [pid 21423] [client <ip>]
ModSecurity: Access denied with code 44 (phase 2).
Match of "eq 0" against "MULTIPART_UNMATCHED_BOUNDARY" required.
[file "/etc/httpd/conf.d/mod_security.conf"]
[line "35"] [id "<another id>"]
[msg "Multipart parser detected a possible unmatched boundary."]
[hostname "<my host>"] [uri "<my script>"] [unique_id "<id (useless I think)"]
但是,我现在无法找到如何编辑mod_security(它有默认配置和未激活规则)的配置,以便(我认为)允许上传这个“大”文件。我正在运行Apache 2.4/CentOS 7中的PHP 5.3。
"id:'<the id>',phase:2,t:none,log,deny,status:44,msg:'Multipart request body
failed strict validation, 并使用了您提供的removeByID函数来删除该ID,但它仍然存在。 - Octal
SecRequestBodyLimit
来解决上传问题吗?默认值为12.5MB。 - Byron70