search
Homephp教程php手册解决PHP程序上传最大2M问题解决方法

刚刚介绍过在iis上传文件不能大于200KB的解决办法,下面有朋友就问我为什么php中最大上传文件不能超过2MB呢,这个问题要怎么设置呢?下面小编来给各位介绍一下吧.

打开位于:C:/WINDOWS 的 php.ini 文件,这个php.ini不一定是在C盘,要看你配置环境时这个文件是放在那个盘,像我就不喜欢放在C盘了.

然后在php.ini中我们找到如下几个参数进行修改,代码如下:

upload_max_filesize = 2M  (php程序最大可以上传的附件值)

post_max_size = 8M  (form表单POST类型上传的最大可以上传值)

memory_limit = 8M  (限制php程序运行时占用的内存大小最大为 8M)

max_execution_time = 30  (PHP程序执行时间,单位:秒)

另外要确认上传的

里没有类似下面的这行这样也是限制上传大小用的.

补充:对于大文件我们在上传时间上也需要设置否则可能碰到上传超时了.

解决上传超时,默认是30秒,改为如下代码:

max_execution_time = 0,0代表不限制

max_input_time = 600 ;每个PHP页面接收数据所需的最大时间,默认60秒

memory_limit  = 128M ;每个PHP页面所吃掉的最大内存,默认8M

注意:upload_tmp_dir = "D:/APM/PHP/uploadtemp/" //phprm.com

传文件时系统使用的缓存目录,如果此目录所在磁盘空间不足的话您将不能上传文件,最后重启apache环境或iis环境即可.

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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment