So you tried to upload a plugin or theme to your WordPress dashboard and you get an error that says,

The uploaded file exceeds the upload_max_filesize directive in php.ini

This error simply means that you are uploading a file with size that is more then the maximum upload limit allowed in the configuration files of your web host. To fix this error, you need to increase this limit. There are two steps to fix the uploaded file exceeds the upload_max_filesize in php.ini error in WordPress.

1. Login to your website via FTP and go to wp-admin directory. Here, edit the php.ini file and increase the values of two variables in it,

upload_max_filesize = 2M
post_max_size = 2M

Increase the variables to a higher value like 64M. Then save this file.

Then go to the root directory of your website and make the same change in php.ini file there.

If you don’t see a php.ini file in the directories on your website, you need to contact your web host to find out how you can edit the php.ini file.

2. In the root directory of your website, locate the .htaccess file and add the following code at the end of it,

# BEGIN Increase Max Upload Size
php_value upload_max_filesize 20M
php_value post_max_size 20M
php_value max_execution_time 300
php_value max_input_time 300
# END Increase Max Upload Size

You can also send them this error details and ask them to fix it. Most good web hosting companies for WordPress have already fixed this error.

You can also upload larger files directly to your site using FTP if you don’t want to mess around with editing files.