Home >Backend Development >PHP Tutorial >Things to note when uploading large files in PHP environment_PHP Tutorial
Public environment frontend
nginx linux environment precautions
Things to note when uploading large files in PHP environment:
/usr/local/php/etc/php-fpm.conf.default
request_terminate_timeout = 0 //This is the execution time of fastcgi, which is not limited by default
client_max_body_size 256m;
fastcgi_buffer_size 256k;
fastcgi_buffers 16 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
fastcgi_connect_timeout 3000;
fastcgi_send_timeout 3000;
fastcgi_read_timeout 3000;
In addition, PHP also needs to be configured:
memory_limit 512M
max_execution_time 0
post_max_size 256M
upload_max_filesize 256M
Things to note in apache windows environment
Configure the php.ini file (taking uploading files below 500M in size as an example)
Find the following options and modify ->
file_uploads = On ;Turn on file upload options
upload_max_filesize = 500M ;Maximum upload file size
If you want to upload a relatively large file, the above two are not enough. You must increase the server cache limit and lengthen the maximum execution time of the script
post_max_size = 500M;post upper limit
max_execution_time = 1800 ; Maximum execution time of each script, in seconds Maximum execution time of script
max_input_time = 1800 ; Maximum amount of time each script may spend parsing request data
memory_limit = 128M; Maximum amount of memory a script may consume (128MB) memory limit