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

How to modify attachment size in php.ini

hzc
Release: 2023-03-01 12:16:01
Original
2218 people have browsed it

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 ;
Copy after login

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

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

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

4.post_max_size = 8m ;
Copy after login

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 <= 8M is not a problem. Under normal network conditions Down.

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 ;
Copy after login

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

2.max_input_time = 600 ;
Copy after login

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

3.memory_limit = 8m ;
Copy after login

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
Copy after login

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

service php-fpm restart
systemctl restart php-fpm
Copy after login

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!

Related labels:
php
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