search
Homephp教程php手册php环境上传大文件需要注意的事项

php环境上传大文件需要注意的事项

Jun 13, 2016 am 09:03 AM
phpuploadbigdocumentNoticeenvironmentofneed

php环境上传大文件需要注意的事项

 公共的环境前段


 
 
 
 
Send this file:  
 

nginx+linux环境注意事项


php环境上传大文件需要注意的事项:

/usr/local/php/etc/php-fpm.conf.default
request_terminate_timeout = 0   //这个是fastcgi的执行时间,默认不限制的
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;

另外PHP也需要配置:

memory_limit 512M
max_execution_time 0
post_max_size 256M
upload_max_filesize 256M


apache+windows环境下注意事项

配置php.ini文件 (以上传500M以下大小的文件为例) 
查找以下选项并修改-> 
file_uploads = On ;打开文件上传选项 
upload_max_filesize = 500M ;上传文件上限


如果要上传比较大的文件,仅仅以上两条还不够,必须把服务器缓存上限调大,把脚本最大执行时间变长 
post_max_size = 500M ;post上限 
max_execution_time = 1800 ; Maximum execution time of each script, in seconds脚本最大执行时间 
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)内存上限

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
Will R.E.P.O. Have Crossplay?
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Atom editor mac version download

Atom editor mac version download

The most popular open source editor