Select Page

How to Increase the Maximum File Upload Size / Limit for WordPress

How to Increase the Maximum File Upload Size / Limit for WordPress

At some point you’ll no doubt find that you want to upload a file to WordPress but it’s too big.  When this happens you’ll get the “exceeds the maximum upload size for this site” message.

No doubt the first time you’ll see this is when you’re in a hurry – with a deadline to meet or you just want to get off home.

The good news is it’s easy to fix.  There are at least two settings you need to consider – the upload size limit and the timeout.

The bigger the files you are allowing to upload, the longer it will take them to upload and therefore the timeout needs to be increased as well.

The methods described below for shared hosting will work on a number of platforms but not all.  If you make the recommended changes and your upload limit remains unchanged, you will have to contact your hosting provider to increase the limits.

Method One – Shared Hosting php.ini

The php.ini file defines settings relating to the PHP language – which is the language WordPress is written in.

For shared hosting, edit or create the file php.ini in your WordPress site’s root directory via FTP or the File Manager app in your hosting account’s control panel.

This method also works for virtual machines and dedicated servers.

If the file exists, download it to your local machine for editing, otherwise create a new php.ini file on your local machine to upload.

Using your favourite editor create or edit the php.ini file

image

Add the lines (or edit the existing lines if the file is already present) as above and save your php.ini file.  Note 16M is to allow files sizes of up to 16MB to be uploaded.  You may require a different number depending on your file sizes.

Upload the file to your WordPress site’s root folder.

Method Two – Server’s php.ini

If you have your own virtual machine or dedicated server you may wish to increase the upload limit server wide (i.e. if you are hosting multiple sites etc).

The php.ini file can be found in a number of different places, but for Ubuntu it can currently be found in /etc/php/7.0/apache2 where “7.0” is the version of php installed on the server.

You can find all php.ini files on your server, with the simple command

> sudo find / | grep php.ini

image

We can see a number of files above and the one we want to edit is in /etc/php/7.0/apache2.

Using your favourite editor edit the file:

> sudo nano /etc/php/7.0/apache2/php.ini

or my favourite editor

> sudo vi /etc/php/7.0/apache2/php.ini

If you haven’t used vi before you may be better sticking with Nano.

image

Search for the lines :

upload_max_filesize =

post_max_size =

max_execution_time =

and add/edit the required values after the equal sign.

You will most likely need to reload the settings for Apache

> sudo service apache2 reload

Method Three – htaccess

The .htaccess file can be found  in your WordPress site’s root directory.

For shared hosting download the .htaccess file in your WordPress site’s root directory via FTP or the File Manager app in your hosting account’s control panel.

You may also edit the file directly if you have a virtual machine or dedicated server with command line access.

Add or edit the following:

php_value upload_max_filesize 16M

php_value post_max_size 16M

php_value max_execution_time 300

php_value max_input_time 300

Save the file and upload it back to the WordPress root directory.

Method Four – MultiSite Installs

If your WordPress installation is a multisite install then you’ll need to increase the setting in WordPress.  You may also need to apply one of the methods one to three above.

image

Then scroll down to the max upload file size setting.

image

Note that the size is in KB rather than MB.

And then save the changes.

Leave a reply