How can I modify the limit on the size of PHP file uploads?

Source: Internet
Author: User
Tags php file upload
Method 1: Modify the related parameters of php. ini: file_uploadson; enable or disable file upload over HTTP. The default value is ON, which is to open upload_tmp_dir. The file is uploaded to the place where the temporary file is stored ON the server. If it is not specified, the default Temporary Folder will be used. Upload_max_filesize2m; wangwen business, that is, allow

Method 1: Modify the related parameters of php. ini: file_uploads = on; whether to allow file upload through HTTP. The default value is ON, which is to open upload_tmp_dir. The file is uploaded to the place where the temporary file is stored ON the server. If it is not specified, the default Temporary Folder will be used. Upload_max_filesize = 2 m; wangwen business, that is, allow

Method 1: Modify php. ini
Description of related parameters:
File_uploads = on; whether to allow file upload over HTTP. ON is enabled by default.
Upload_tmp_dir; upload the file to the place where the temporary file is stored on the server. If it is not specified, the default Temporary Folder will be used.
Upload_max_filesize = 2 m; wangwen business, that is, the maximum file size allowed to be uploaded. The default value is 2 MB.
Post_max_size = 8 m; the maximum value that can be received by posting a form to PHP, including all values in the form. The default value is 8 Mb.
Max_execution_time = 30; maximum time (in seconds) for running each PHP page. The default value is 30 seconds.
Max_input_time = 60; maximum time required for receiving data on each PHP page. The default value is 60 seconds.
Memory_limit = 128 m; maximum memory size consumed by each PHP page. The default value is 128 M. If you think it is small, you can set it to bigger. 128 is enough.
Max_execution_time= 600
Max_input_time= 600
Upload_max_filesize = 32 m
Post_max_size = 32 m

After modifying the preceding parameters, you can upload a large volume of files as permitted by the network.

Method 2: Use the. htaccess File
This method does not require direct modification of php. ini, which is applicable to virtual hosts.
Configure Apache to support. htaccess

The Code is as follows:

// Find

Options FollowSymLinks
AllowOverride None

// Change

Options FollowSymLinks
AllowOverride All

// You can.

Create a new. htaccess file in the directory. This is not allowed in windows by default. You can create a file under Dreamweaver file management.

Write in. htaccess

The Code is as follows:

Php_value post_max_size 12 m
Php_value upload_max_filesize 12 m
Php_value max_execution_time 120
Php_value max_input_time 240

OK.

Supplementary explanation:
The method of using ini_set ("post_max_size", "80 M"); does not work.

The modifiable range of post_max_size is PHP_INI_PERDIR.
PHP_INI_PERDIR is a domain command that can only be modified in the php. ini, httpd. conf, or. htaccess file, so it does not work.
Php_value name value
Set the value of the specified command. Only commands of the PHP_INI_ALL and PHP_INI_PERDIR types can be used. To clear the previous set value, set the value to none.

Note: Do not use php_value to set a Boolean value. Php_flag should be used (see below.
Php_flag name on | off
The configuration command used to set the boolean type. Only commands of the PHP_INI_ALL and PHP_INI_PERDIR types can be used.
Php_admin_value name value

Set the value of the specified command. It cannot be used in the. htaccess file. Any value set in php_admin_value cannot be overwritten by commands in. htaccess or virtualhost. To clear the previous set value, set the value to none.
Php_admin_flag name on | off

Articles you may be interested in:
How to break through the php file size limit
PHP increases the file upload size limit
How to cancel the limit of uploading PHP files not greater than 2 MB
Methods to break through the PHP file upload size limit
Adjust the PHP file size limit

How to modify the PHP file upload size limit in the original article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.