Home >Backend Development >PHP Tutorial >PHP method to upload large files (modify Apache configuration file)

PHP method to upload large files (modify Apache configuration file)

不言
不言Original
2018-04-17 10:13:322360browse

This article introduces the method of uploading large files in PHP (modifying the Apache configuration file). It has a certain reference value. Now I share it with you. Friends in need can refer to it.

Open php. ini configuration file

Parameter Setting Description
file_uploads on Switch to allow file uploads via HTTP. The default is ON, that is,
upload_tmp_dir - files are uploaded to the server where temporary files are stored. If not specified, the system default temporary folder will be used
upload_max_filesize 8m Wangwen business, that is, the maximum size of the file allowed to be uploaded. The default is 2M

post_max_size 8m refers to the maximum value that can be received through form POST to PHP, including all values ​​in the form. The default is 8M

Generally, after setting the above four parameters, when the network is normal, uploading a file of But if you want to upload a large file >8M, it will definitely work if you only set the above four items. Unless your network really has a 100M/S upload speed, you have to continue setting the following parameters.

max_execution_time 600 The maximum time value (seconds) for each PHP page to run, the default is 30 seconds
max_input_time 600 The maximum time required for each PHP page to receive data, the default is 60 seconds
memory_limit 8m per The maximum memory consumed by a PHP page, the default is 8M

After modifying the above parameters, you can upload large files under normal circumstances allowed by the network

Related recommendations:

PHP method to upload pictures and files

PHP tips for uploading and saving to folders

The above is the detailed content of PHP method to upload large files (modify Apache configuration file). For more information, please follow other related articles on the PHP Chinese website!

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