Uploading a file larger than 2GB using PHP

前端 未结 6 1955
情歌与酒
情歌与酒 2020-12-01 16:50

I\'m trying to upload a file larger than 2GB to a local PHP 5.3.4 server. I\'ve set the following server variables:

         


        
6条回答
  •  再見小時候
    2020-12-01 17:28

    I don't know about in 5.3.x, but in 5.2.x there are some int/long issues in the PHP code. even if you're on a 64-bit system and have a version of PHP compiled with 64-bit, there are several problems.

    First, the code that converts post_max_size and others from ascii to integer stores the value in an int, so it converting "9G" and putting the result into this int will bork the value because 9G is a larger number than a 32-bit variable can hold.

    But there are also several other areas of PHP code that are used with the Apache module, CGI, etc. that need to be changed from int to long.

    So...for this to work, you need to edit the PHP code and compile it by hand (make sure you compile it as 64-bit). here's a link to a list of diffs:

    http://www.archive.org/~tracey/downloads/patches/karmic-64bit-post-large-files.patch

    Referenced from this php bug post: http://bugs.php.net/bug.php?id=44522

    The file above is a diff on 5.2.10 code, but I just made the changes by hand to 5.2.17 code and i just uploaded a 3.4gb single file through apache/php (which hadn't worked before the change).

    ope that helps.

提交回复
热议问题