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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

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.