PHP upload size limit modification

韦小宝
Release: 2023-03-20 12:38:02
Original
12533 people have browsed it

Uploading is a very common and important point in PHP development, and the size of PHP upload is limited. In order to better improve the upload speed of PHP, we need to modify the upload size limit, okay! Let’s take a look at how to modify PHP upload restrictions!

  1. General file upload, unless the file is very small. Like a 5M file, it may take more than a minute to upload.
    But in php, the default The longest page execution time is 30 seconds. That is to say, if it exceeds 30 seconds, the script will stop executing.
    This will lead to the situation that the web page cannot be opened.

At this time we can Modify max_execution_time
Look for

max_execution_time
Copy after login

in php.ini. The default is 30 seconds. Change to

max_execution_time = 0
Copy after login

0 to indicate no limit

2. Modify post_max_size to set the maximum size allowed for POST data. This setting also affects file uploads.
The default post_max_size of php is 2M. If the POST data size is larger than post_max_size, $_POST and $_FILES superglobals will be empty.

Find post_max_size. Change to

post_max_size = 150M
Copy after login

3. Many people will change the second step. But when uploading files, the maximum size is still 8M.
Why? We also need to change a parameter upload_max_filesize to indicate the maximum size of the uploaded file.

Look for upload_max_filesize, the default is 8M and change it to

upload_max_filesize = 100M
Copy after login

In addition, it should be noted that post_max_size is better than upload_max_filesize.

More Upload articles:

In PHP programs, we often encounter this problem. When uploading attachments, many attachments, such as pictures, etc., are successfully uploaded, but in fact only 20 attachments exist, or directly Failed to upload error.

How to break through the max_file_uploads limit of PHP uploading multiple files

This article mainly introduces the ZenTao attachment size limit and the PHP upload file size limit , students who are interested in PHP tutorials can refer to it.

ZenTao attachment size limit, PHP upload file size limit

The above is the detailed content of PHP upload size limit modification. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!