Home >Backend Development >PHP Tutorial >Two PHP upload file size limit solutions_PHP tutorial
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.
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!