Programming WordPress

How to Increase the File Upload Size in WordPress for All-in-One WP Migration Plugin

wordpress all-in-one wp migration plugin upload limit php

The default file upload size for WordPress websites is limited to 128 MB which is mostly sufficient if you are just uploading small photos and videos for embedding into your posts or webpages. 

However, there are situations where you may have to increase this upload limit or file size restriction. If you are using the All-In-One WP Migration plugin for the first time then you may run into this problem where the filesize of your website exceeds the default WordPress upload limit on the new hosting provider.

All-In-One WP Migration free tier allows website export files with file sizes up to 512 MB. However, you won’t be able to import this file into the new WordPress site running on your new hosting provider, without first changing the default upload limit set by WordPress.

How to Change the Upload Limit in WordPress

This can be done in many different ways, you can either use the .htaccess file of your website or make changes to the wordpress configuration files. You can also make changes to the php configuration files.

Increase Upload Limit by Editing the .htaccess File

The .htaccess file is usually present in the root directory of your wordpress installation. Open this file and add the following lines of code at the end of the file.

php_value upload_max_filesize 512M
php_value post_max_size 512M 
php_value max_execution_time 300 
php_value max_input_time 300

Increase Upload Limit by Editing WordPress Configuration File

Try adding the following lines of code directly in the WordPress Configuration File which is also present in the root directory of your WordPress installation.

Open the root directory of your WordPress website or the directory where your WordPress files are located and look for the wp-config.php file. You have to add the following lines of code to this configuration file.

Make sure you add the code just before the following line which says  

/* That's all, stop editing! Happy publishing. */

Add the following line of code just before the above line of code.

@ini_set('upload_max_size', '512M');
@ini_set('post_max_size', '512M');
@ini_set('max_execution_time', '300');

After adding this code save the changes to the wp-config.php file. Logout of WordPress and login again. Then Navigate to Media > Add New and check whether the upload limit has increased.

Use a Plugin to Increase File Upload Size

There are several plugins available that can help you increase the upload file size without manually editing files. Some popular plugins include:

Increase Maximum Upload File Size

WP Increase Upload Filesize

WP Maximum Upload File Size

These plugins provide an easy interface to increase the upload limits.

Increase Limit in php.ini File on Apache Servers

If you have a virtual server or have access to the server files, or you are running WordPress on localhost (on your desktop computer using Xampp) then you can also try making changes to the php.ini configuration files.

This php.ini file may have a different location or directory depending on your Linux distribution or operating system configuration. In most cases it’s located inside the php directory on your Apache server.

In our case it’s located at the following location,

/etc/php/7.4/apache2/php.ini

You can open this file using the nano or vim editor (we have used nano editor) using the following command. Replace the path with the path where your php.ini file is located.

sudo nano /etc/php/7.4/apache2/php.ini

In this file look for the following settings under the following heading, 

;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;

Then look for the following lines of code

; Maximum amount of memory a script may consume
; http://php.net/memory-limit
memory_limit=128M

Increase the memory_limit=512M in the above code as shown below.

memory_limit=512M


Don't close the file after changing the memory limit. Scroll down and change two more lines of code .

Now, look for the following lines of code in php.ini file, under the following heading

;;;;;;;;;;;;;;;;;
; Data Handling ;
;;;;;;;;;;;;;;;;;

Look for the following code,

; Maximum size of POST data that PHP will accept.
; Its value may be 0 to disable the limit. It is ignored if POST data reading
; is disabled through enable_post_data_reading.
; http://php.net/post-max-size
post_max_size=256M

Change the last line to the following,

post_max_size=512M

Now, we have to change one more line of code, just look under the following heading of php.ini file. 

;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;

Then look for the following lines of code

; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize=40M

You have to change upload_max_filesize=40M to,

upload_max_filesize=512M

Now, Close the editor by pressing Ctrl + X. Then Press Y to save the changes and exit the nano editor. Restart your Apache Server for the changes to take effect. Login into WordPress and it would have the new upload limit activated.

Change the Upload Limit for WordPress on Localhost/Xampp

If you are trying to change the upload limit on Xampp or Localhost, then you can edit the php.ini file directly in the notepad.

For Windows, you can find the php.ini file in the C:\xampp\php\php.ini-Folder (Windows) or in the etc-Folder (within the xampp-Folder).

Under Linux, most distributions put Lampp under /opt/lampp, so the file can be found under /opt/lampp/etc/php.ini

It can be edited using a normal Text-Editor like the Notepad.

Nginx File Upload Size Configuration (For Nginx Users)

If your WordPress site is hosted on a server using Nginx, you need to edit the Nginx configuration file. Add or modify the following lines in your nginx.conf file.

http {
    client_max_body_size 512M;
}

After making changes, restart Nginx to apply the new configuration.

File Upload Size Configuration For Custom PHP Handler 

For servers using custom PHP handlers like suPHP, you might need to create or modify a php.ini file in your WordPress root directory with the following settings:

upload_max_filesize = 512M
post_max_size = 512M
max_execution_time = 300

After adding these lines, make sure that your server is configured to use this custom php.ini file.

After attempting these changes, you should verify that the new settings have taken effect. You can do this by going to the WordPress dashboard, navigating to Media > Add New, and checking the maximum upload file size limit displayed on the upload page. If the new limit is not displayed, you might need to clear your browser cache or restart your server for the changes to take effect.

If none of these methods work then you can try contacting your hosting provider and request them to increase the file upload limits in the server configuration.