Home  >  Article  >  Backend Development  >  Modify PHP upload file size limit

Modify PHP upload file size limit

WBOY
WBOYOriginal
2016-07-25 08:54:54875browse
Introducing the method of modifying the size limit of uploaded files in PHP. The default file upload size in PHP is 2M. The specific modification method is shared here for the reference of friends in need.

1. The default maximum execution time of this page in PHP is 30 seconds. That is to say, if it exceeds 30 seconds, the script will stop executing. This results in the inability to open the web page. At this time we can modify max_execution_time Search in php.ini max_execution_time The default is 30 seconds. Change to max_execution_time = 0 0 means no limit

2. Modify post_max_size to set the maximum size allowed for POST data. This setting also affects file uploads. PHP's default post_max_size is 2M. If the POST data size is greater than post_max_size $_POST and $_FILES superglobals will be empty. Find post_max_size . Change to: post_max_size = 150M

3. After completing the second step of modification, the maximum file size when uploading is still 8M. You also need to modify a parameter upload_max_filesize to indicate the maximum size of the uploaded file. Find upload_max_filesize, the default is 8M and change to upload_max_filesize = 100M

In addition, post_max_size is better than upload_max_filesize.



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