今天改最大上传限制时发现的..一开始将POST_MAX_SIZE设为3G后报错:
PHP Warning: Unknown: POST Content-Length of 0 bytes exceeds the limit of -1149239296 bytes in Unknown on line 0
最后查了下咨料发现:
Note: PHP allows shortcuts for bit values, including K (kilo), M (mega) and G (giga). PHP will do the conversions automatically if you use any of these. Be careful not to exceed the 32 bit signed integer limit (if you’re using 32bit versions) as it will cause your script to fail.
将POST_MAX_SIZE设为2047M,解决问题.
来源: http://home.blueidea.com/apps.php?do=bxna&ac=view&feedid=11994
一般的文件上传,除非文件很小.就像一个5M的文件,很可能要超过一分钟才能上传完.
但在php中,默认的该页最久执行时间为 30 秒.就是说超过30秒,该脚本就停止执行.
这就导致出现 无法打开网页的情况.这时我们可以修改 max_execution_time
在php.ini里查找
max_execution_time
默认是30秒.改为
max_execution_time = 0
0表示没有限制
另一种方法是可以在php程序中加入
set_time_limit();
来设定页面最久执行时间.
set_time_limit(0);//0表示没有限制
#######
修改 post_max_size 设定 POST 数据所允许的最大大小。此设定也影响到文件上传。
php默认的post_max_size 为2M.如果 POST 数据尺寸大于 post_max_size $_POST 和 $_FILES superglobals 便会为空.
查找 post_max_size .改为
post_max_size = 150M
参数upload_max_filesize 表示所上传的文件的最大大小。
查找upload_max_filesize,默认为8M改为
upload_max_filesize = 100M
◎##########
另外要说明的是,post_max_size 大于 upload_max_filesize 为佳.