Modify the attachment size limit of 2 MB in WordPress/php + iis default attachment size modification method

Source: Internet
Author: User
Modify the size limit of 2 MB for attachments uploaded to WordPress php + iis the default size modification method for attachments uploaded to php + iis. After WordPress is installed on the server, it is found that the attachment size is limited to 2 MB during use.

If the server is a local machine, you can drag the file to the attachment storage folder and reference the link where the attachment is needed.

However, this lagging method is not a solution after all. You should modify the size limit to make it easy to use.

 

After searching through the Internet, there are a lot of methods, but most of them are duplicated with incomplete information. Let's talk about my last change method for reference only.

 

The Server version is Windows Server 2003 SP2.

WordPress setup: IIS + PHP + MySql

 

1. First, create an info. php file under the root directory of the website.

For example, D: \ wwwRoot \ wp is the root directory of the website. In this directory, create a txt file, enter the following code, and save it as info. php.

1 
 2 echo phpinfo();
3 ?>

 

Then access the file in the browser, such as http: // localhost/info. php.

The purpose of this step is to view the location of php. ini on the server + the default attachment size information.

Modify php. ini, but the premise is that you must modify the correct position of php. ini. Otherwise, it will not work even if php. ini is modified tens of millions times.

If you do not buy a space but build it by yourself, you may not modify the correct php. ini location because multiple php. ini files exist.

The position of php. ini is C: \ WINDOWS \ php. ini.

 

2. Modify the php. ini found in step 1.

Open php. ini with a WordPad

Search: memory_limit, post_max_size, upload_max_filesize, max_execution_time, max_input_time

The default value is:


Memory_limit = 128 M // equivalent to memory size adjustable for a single script
Post_max_size = 8 M // maximum size of uploaded files
Upload_max_filesize = 2 M // The default file size to be uploaded. This is the limit of 2 M!
Max_execution_time = 30 // maximum execution time, page wait time
Max_input_time = 60 // What is the maximum input time? The specific meaning is unclear, that is, the upload time is related.

 

Then change it to the desired value, for example:


Memory_limit = 128 M
Post_max_size = 12 M
Upload_max_filesize = 10 M // you can upload files smaller than 10 M.
Max_execution_time = 60
Max_input_time = 60

 

3. Restart the iis service.


This is very important. The above changes will not take effect without restarting.

Restart Method, Start Menu, run, enter: iisreset.

 

If PHP + Apache + MySql is used, restart the Apache service.

 

4. Verify the modification effect

After completing the preceding three steps, check info. php to see that the information has been updated.

 

We can see that the above information is modified. As for the information before modification (2 MB by default), it will not be available here.

 

Note:

The specific settings on each person's server must be slightly different, and the methods on the network are also wide-ranging.

What I'm talking about here is just a method that passes the test on the local machine. It is not universal. So if you cannot set it successfully as described in this article, you need to think about it again.

If you have any good methods, please feel free to discuss them.

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.