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 <= 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 ;
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!