When uploading files to your WordPress website you may have seen this error;

‘The uploaded file exceeds the upload_max_filesize directive in php.ini’

upload max filesize directive in php ini error

This means that you have tried to upload a file larger than your php settings allow.

I see this error when I am creating a website on a brand new hosting account and the account is using a set of default values for the php settings.

My latest example is when trying to upload the Divi theme.

So what did I do?

First, I checked the size of the file I was uploading. I use a Mac, so I went to my Finder window, found the Divi.zip file and looked at its size, 6.8MB.

Then I went to my php.ini settings in my cPanel to see what my max file upload setting was.

To find the php settings, from your cPanel scroll down until you see the ‘SOFTWARE’ section, then click on ‘Select PHP Version’.

select php version from cpanel

This will open up a whole bunch of options, you do not need to worry about these, just click on the link that says ‘Switch to PHP Options’.

 switch to php options image

 

This will open up a set of php options. Look for the upload_max_filesize option. Click on the number to the right of the option. You may see 2M which is a common default value. When you click on this number a drop down menu will appear, choose a value higher than the file you are trying to upload. Then click apply. I have chosen 8M.

upload max file size value image

Once you have selected your size, click ‘Apply’. The drop down window will disappear.

I want you to now check two other values, memory_limit and post_max_size. They need to be equal or higher than the value you have selected for upload_max_filesize. if they are not, increase their size too.

Don’t forget to save your settings! There is a little save button on the left at the bottom of the settings.

Now when you try to upload your file, your error should be gone.

If you don’t want to try this yourself, you can ask your hosting provider, they should be able to help you. If not, you can contact me for assistance.

Good luck if you choose to try this out, let me know in the comments below if it worked for you.