Home >Backend Development >PHP Tutorial >Two PHP upload file size limit solutions_PHP tutorial

Two PHP upload file size limit solutions_PHP tutorial

WBOY
WBOYOriginal
2016-07-15 13:27:15903browse

PHP is still relatively commonly used, so I researched the PHP upload file size limit, and here I will share with you the solution to the PHP upload file size limit. I hope it will be useful to everyone. PHP itself is a simple yet powerful language. The PHP language has core features such as powerful string and array processing capabilities, and has greatly improved support for object-oriented programming (PHP5 and above). By using standard and optional extension modules, PHP applications can connect to more than a dozen databases such as MySQL or Oracle, draw, create PDF files, and create and parse XML files.

You can also use C language to write your own PHP extension module. For example, provide a PHP interface function in an existing code base. You can also run PHP under Windows, use COM to control other Windows applications such as Word and Excel, or use ODBC to connect to a database.

In China, PHP once kept pace with Microsoft's ASP and was a commonly used network programming language. ASP3.0 has been abandoned by Microsoft and will no longer be updated. Some people may think that PHP is also going to be dead soon, right? However, the fact is exactly the opposite. PHP is not only developing at a high speed, leaving ASP far behind, but also gradually becoming the most widely used and popular language on the Internet.

  • http://www.netcraft.com), there are now more than 23 million website servers using PHP in the world (accounting for more than a quarter of global websites, the number of global websites includes all static There are about 100 million websites). Judging from Netcraft's data, PHP has developed rapidly this year and has a strong upward momentum. According to TIOBE's ranking of the world's most popular programming languages ​​(http://www.tiobe.com/tpci.htm), PHP ranks firmly in the top five. Usually the maximum upload file size can be set in php.ini, but sometimes the file size can only be smaller than 512k when uploading? If it is slightly larger, an error will occur, the upload page cannot be found, "The page cannot be displayed,..., the server cannot be found or a DNS error occurs.

    Solution to PHP upload file size limit:

    First: Check the following lines in php.ini:

    <ol class="dp-xml">
    <li class="alt"><span><span class="attribute"><font color="#ff0000">upload_max_filesize</font></span><span> = </span><span class="attribute-value"><font color="#0000ff">8M</font></span><span> </span></span></li>
    <li class="">
    <span></span><span class="attribute"><font color="#ff0000">post_max_size</font></span><span> = </span><span class="attribute-value"><font color="#0000ff">10M</font></span><span> </span>
    </li>
    <li class="alt">
    <span></span><span class="attribute"><font color="#ff0000">memory_limit</font></span><span> = </span><span class="attribute-value"><font color="#0000ff">20M</font></span><span> </span>
    </li>
    </ol>

    Change these values ​​​​to what I said and see if there are any problems. In addition, confirm the uploaded< There is no line like the following in form> This is also used to limit the upload size

    Second: If it is apache 2. It is necessary to modify the LimitRequestBody 524288 in

    <ol class="dp-xml"><li class="alt"><span><span>/etc/httpd/conf.d/php.conf </span></span></li></ol>

    to make 524288 (=512×1024) larger, such as 5M (=5×1024×1024). In this way, the above problems will not occur when uploading. The upload will not respond. The unreality of this page will also be resolved!


    www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/446549.htmlTechArticlePHP is still relatively commonly used, so I studied the PHP upload file size limit and share it with everyone here. Let’s look at the solution to the PHP upload file size limit, I hope it will be helpful to everyone...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn