Home  >  Article  >  Backend Development  >  How to modify attachment size in php.ini

How to modify attachment size in php.ini

hzc
hzcOriginal
2020-06-05 14:26:492108browse

How to modify attachment size in php.ini

How to modify the attachment size in php.ini

1. Open php.ini

1. file_uploads = on ;

Whether to allow uploading via HTTP The file switch, the default is ON;

2. upload_tmp_dir ;
文件上传至服务器上存储临时文件的地方,如果没指定就会用系统默认的临时文件夹;
3.upload_max_filesize = 8m ;

Wangwen business, that is, the maximum size of the file allowed to be uploaded, the default is 2M;

4.post_max_size = 8m ;

refers to all the data sent to PHP through the form POST The maximum value that can be received, including all values ​​in the form, is 8M by default;

Generally, after setting the above four parameters, 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.

2. Further configure the following parameters

1.max_execution_time = 600 ;

The maximum time value (seconds) for each PHP page to run, the default is 30 seconds;

2.max_input_time = 600 ;

The place where each PHP page receives data The maximum time required, the default is 60 seconds;

3.memory_limit = 8m ;

The maximum memory consumed by each PHP page, the default is 8M;

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

max_execution_time = 600
max_input_time = 600
memory_limit = 32m
file_uploads = on
upload_tmp_dir = /tmp
upload_max_filesize = 32m
post_max_size = 32m

3. Restart the php service to make the configuration take effect

service php-fpm restart
systemctl restart php-fpm

Recommended tutorial: "PHP Tutorial"

The above is the detailed content of How to modify attachment size in php.ini. 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
Previous article:How to set timeout in phpNext article:How to set timeout in php