欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  php教程

windows/linux中PHP文件上传大小修改

程序员文章站 2022-06-03 09:16:38
...
在php中默认只能上传2MB大小的文件,如果想上传更多更大的文件我们需要修改一些参数,下面大家来参考一下。

linux系统

1、/usr/local/nginx/conf/nginx.conf
修改

client_max_body_size

2、/usr/local/php/etc/php.ini

修改

post_max_size
upload_max_filesize

3、重启LNMP /root/lnmp restart

windows系统

php默认的post_max_size 为2M.如果 POST 数据尺寸大于 post_max_size $_POST 和 $_FILES superglobals 便会为空.
查找

post_max_size .

改为
post_max_size = 150M

查找upload_max_filesize,默认为8M改为

upload_max_filesize = 100M

另外要说明的是,post_max_size 大于 upload_max_filesize 为佳.

总结

其实就是修改php.ini中的三个参数

upload_max_filesize = 8M
post_max_size = 10M
memory_limit = 20M