国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > PHP > 正文

php環境上傳大文件需要注意的事項

2024-09-04 11:45:15
字體:
來源:轉載
供稿:網友

公共的環境前段:

  1. <form enctype="multipart/form-data" action="upload.php" method="POST">  
  2. <!-- MAX_FILE_SIZE must precede the file input field -->  
  3. <input type="hidden" name="MAX_FILE_SIZE" value="100000000" />  
  4. <!-- Name of input element determines name in $_FILES array -->  
  5. Send this file: <input name="userfile" type="file" />  
  6. <input type="submit" value="Send File" />  
  7. </form> 

nginx+linux環境注意事項

php環境上傳大文件需要注意的事項:

/usr/local/php/etc/php-fpm.conf.default

request_terminate_timeout = 0   //這個是fastcgi的執行時間,默認不限制的

  1. client_max_body_size 256m; 
  2.  
  3. fastcgi_buffer_size 256k; 
  4. fastcgi_buffers 16 256k; 
  5. fastcgi_busy_buffers_size 256k; 
  6. fastcgi_temp_file_write_size 256k; 
  7.      
  8. fastcgi_connect_timeout 3000; 
  9. fastcgi_send_timeout 3000; 
  10. 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)內存上限

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 承德县| 平南县| 沐川县| 同心县| 修武县| 简阳市| 伊宁市| 芦山县| 凤城市| 吉林省| 旬阳县| 桦甸市| 东宁县| 栖霞市| 武功县| 大关县| 彝良县| 南郑县| 宁陕县| 仁布县| 武宁县| 镇江市| 句容市| 澄迈县| 集贤县| 宣武区| 梁平县| 河北省| 琼中| 浙江省| 珲春市| 东阿县| 萍乡市| 内黄县| 巴南区| 东至县| 德钦县| 霍林郭勒市| 万全县| 商河县| 耒阳市|