【问题标题】:Debian Jessie - Apache2 / PHP 5.6, can't upload more than 128kbDebian Jessie - Apache2 / PHP 5.6,不能上传超过 128kb
【发布时间】:2015-03-27 12:07:48
【问题描述】:

我遇到了一个让我发疯的问题!我最近将我的服务器更新为 Jessie(希望我现在没有!)但自从我更新后,我一次上传的文件不能超过 128KB。

我已经尝试了所有常见的明显选项 - 检查 php.ini 的最大文件大小、执行时间等,但没有解决方案。

;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;

; Whether to allow HTTP file uploads.
; http://php.net/file-uploads
file_uploads = On

; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
; http://php.net/upload-tmp-dir
;upload_tmp_dir = /var/tmp

; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize = 500M

; Maximum number of files that can be uploaded via a single request
max_file_uploads = 50

以上是我的 CLI、CGI 和 apache2 的 php.ini 文件的摘录。

我想不出还有什么要检查的。如果我尝试上传比这更大的任何内容,我要么从服务器收到 500 响应,要么从我的 Web 浏览器收到“服务器意外断开连接”错误。这个问题意味着如果我通过 WordPress 上传,我会收到“HTTP 错误”,如果我尝试通过 Owncloud 上传,我会收到“连接关闭”。

Debian 杰西 Apache/2.4.10 (Debian) mod_fcgid/2.3.9 PHP/5.6.6-2 OpenSSL/ 1.0.1k

Apache2 错误日志是这样的……

[Fri Mar 27 11:32:18.736845 2015] [mpm_prefork:notice] [pid 6012] AH00163: Apache/2.4.10 (Debian) mod_fcgid/2.3.9 PHP/5.6.6-2 OpenSSL/1.0.1k configured -- resuming normal operations
[Fri Mar 27 11:32:18.736959 2015] [core:notice] [pid 6012] AH00094: Command line: '/usr/sbin/apache2'
[Fri Mar 27 11:45:33.881783 2015] [mpm_prefork:notice] [pid 6012] AH00169: caught SIGTERM, shutting down
[Fri Mar 27 11:45:34.861896 2015] [ssl:warn] [pid 6699] AH01906: xxx:8080:0 server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Fri Mar 27 11:45:34.862153 2015] [suexec:notice] [pid 6699] AH01232: suEXEC mechanism enabled (wrapper: /usr/lib/apache2/suexec)
[Fri Mar 27 11:45:34.938830 2015] [auth_digest:notice] [pid 6701] AH01757: generating secret for digest authentication ...
[Fri Mar 27 11:45:35.051083 2015] [ssl:warn] [pid 6701] AH01906: xxx:8080:0 server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Fri Mar 27 11:45:35.081620 2015] [mpm_prefork:notice] [pid 6701] AH00163: Apache/2.4.10 (Debian) mod_fcgid/2.3.9 PHP/5.6.6-2 OpenSSL/1.0.1k configured -- resuming normal operations
[Fri Mar 27 11:45:35.081693 2015] [core:notice] [pid 6701] AH00094: Command line: '/usr/sbin/apache2'
[Fri Mar 27 11:56:41.650574 2015] [mpm_prefork:notice] [pid 6701] AH00169: caught SIGTERM, shutting down
[Fri Mar 27 11:56:42.911897 2015] [ssl:warn] [pid 7255] AH01906: xxx:8080:0 server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Fri Mar 27 11:56:42.912493 2015] [suexec:notice] [pid 7255] AH01232: suEXEC mechanism enabled (wrapper: /usr/lib/apache2/suexec)
[Fri Mar 27 11:56:42.983533 2015] [auth_digest:notice] [pid 7257] AH01757: generating secret for digest authentication ...
[Fri Mar 27 11:56:43.238951 2015] [ssl:warn] [pid 7257] AH01906: xxx:8080:0 server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Fri Mar 27 11:56:43.273995 2015] [mpm_prefork:notice] [pid 7257] AH00163: Apache/2.4.10 (Debian) mod_fcgid/2.3.9 PHP/5.6.6-2 OpenSSL/1.0.1k configured -- resuming normal operations
[Fri Mar 27 11:56:43.274080 2015] [core:notice] [pid 7257] AH00094: Command line: '/usr/sbin/apache2'

有没有人有任何想法或遇到过类似的问题?

提前干杯

【问题讨论】:

    标签: php upload apache2 debian


    【解决方案1】:

    https://www.devside.net/wamp-server/apache-and-php-limits-and-timeouts

    当使用 PHP-FCGI(通过 Apache 的 mod_fcgid 运行的一个单独的 PHP 进程)时,mod_fcgid caps uploads to 128KB by default 在较新的版本(v2.3.6 及更高版本)中,通常在达到该限制时返回“500 服务器错误”。

    【讨论】:

    • 非常感谢。对于那些可能遇到同样问题的人,您需要将: FcgidMaxRequestLen 268435456 FcgidBusyTimeout 300 添加到您的 fcgid 配置文件中。就我而言,它位于 fcgid.conf 下的 /etc/apache2/mods-available 中。添加这两行并重新启动 apache - 应该这样做。确保将最大请求长度设置为等于最大 php 上传大小 - 上面显示的数量为 256MB。再次感谢 dafyk,非常感谢!
    猜你喜欢
    • 1970-01-01
    • 2015-08-27
    • 1970-01-01
    • 2017-10-21
    • 2014-09-11
    • 1970-01-01
    • 2018-01-24
    • 2016-06-24
    • 1970-01-01
    相关资源
    最近更新 更多