WordPress Import uploaded file size more than the Upload_max_filesize value defined in php.ini solution

Source: Internet
Author: User
Tags php file upload
The file size uploaded by WordPress Import exceeds the upload_max_filesize value defined in php.ini.

Reference one:

WordPress Importer Upload Import backup file encountered an error that "uploaded file size exceeds the Upload_max_filesize value defined in PHP.ini". The problem is because the php.ini file limits the maximum upload file size, the default is 2MB, the solution to find this file can be modified slightly in the following way.

The above is an error prompt. Solution first Open php.ini This file, the specific path we look for, I did not test on the server, using the XAMPP Local environment (xampp/php folder), respectively, search upload_max_filesize = 2M and Post_max_ Size = 8M, change the maximum file upload limit, such as change to 40M, and then save, restart the Apache service.

After the modification we re-upload the import test, then should be able to, for example, can upload a larger file. After the import, you can change back to the original size, remember to restart the Apache service.

It is possible that some users who use virtual hosts do not have this permission, and there is a workaround. Export the wordpress XML backup file in batches, such as by category, label, user, time in batches to export, and then upload the import one by one. In addition, there are also some XML file segmentation software, such as the WordPress XML file splitter, WXR file Splitter (this can be customized partition size), the use is also very convenient.

Reference two:

Find post_max_size = 2M (default 2M) to the desired size, such as:
post_max_size = 100M
usually we only do this step and think we can solve the problem. In fact, we need to look at the next step.


Upload_max_filesize represents the maximum value of the uploaded file.
find upload_max_filesize, default to 8M instead
upload_max_filesize = 100M

It is important to note that the post_max_size is greater than the Upload_max_filesize setting as well.

Finally, after the setup is complete, you need to restart Apache.

See the (php.ini Core configuration option description in the PHP manual for details)
upload_max_filesize The maximum size of the uploaded file.
Post_max_size Sets the maximum size allowed for post data.
Memory_limit Sets the maximum number of bytes of memory that a script can request.


php upload files related to the parameters of PHP default upload limit is maximum 2M, want to upload more than this set of files, need to adjust PHP, Apache and other parameters. Let's briefly introduce some of the parameters that are involved in PHP file uploads:

file_uploads
whether to allow the switch to upload files over HTTP, the default is on

Upload_tmp_dir
Upload_tmp_dir used to explain the PHP uploaded files placed in the temporary directory, to upload files, you have to ensure that the server does not close the temporary files and write permissions to the folder, if not specified, PHP uses the system default value

upload_max_filesize
Maximum allowable upload file size, default is 2M

post_max_size
controls the maximum amount of data that PHP can receive in a single form submission using the Post method. If you want to use PHP file upload feature, you need to change this value to be larger than upload_max_filesize

Max_input_time
The time to receive data by post, get, and put is limited in seconds. If your application is running on a low-speed link, you need to increase this value to accommodate the additional time it takes to receive the data

Memory_limit
to prevent running scripts from using the system's available memory heavily, PHP allows you to define memory usage limits. Use the Memory_limit variable to specify a maximum memory capacity variable that can be used by a single script memory_limit value should be appropriate greater than Post_max_size value

Max_execution_time
Max_execution_time sets the time at which PHP waits for the script to complete before forcing the script to terminate, which is calculated in seconds. This variable is useful when the script enters an infinite loop state. However, this feature also causes the operation to fail when there is a legitimate activity that takes a long time to complete, such as uploading large files. In such cases, you must consider increasing the value of this variable to avoid PHP closing the script when the script is performing some important process

looks like php.ini has to figure out how powerful it is.





  • 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.