Increase Size Limit of Media Files WordPress 4.1

The question:

I have edited (created) the php.ini file and the .htaccess file in accordance with this post. I have also found a plug-in (called Upload Max File Size) that claims to raise the file size limit of media files. With the plug-in activated, I see on the add new media screen that the limit has been changed. However, when I attempt to upload a 2.7MB image, I receive the error:

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

The contents of php.ini are:

upload_max_filesize = 32M
post_max_size = 32M
max_execution_time = 300

My .htaccess file contains:

# BEGIN WordPress

php_value upload_max_filesize 100M
php_value post_max_size 1M
php_value max_execution_time 300
php_value max_input_time 300

# END WordPress

I am currently hosting the word press site myself and have root privileges to anything.

The Solutions:

Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.

Method 1

The limiting factor appears to be in your .htaccess file:

php_value post_max_size 1M

The post_max_size needs to be at least equal to the upload_max_filesize, so increase that to 100M. The settings in .htaccess should override the settings in php.ini.


If that doesn’t work, and since you have full root privileges, you can modify the main php.ini file. To find where php.ini is located, create a temporary PHP file in your website (i.e. temp.php) containing this:

<?php phpinfo(); ?>

Load the page in a web browser, and look for “Loaded Configuration File” near the top, with a value like /etc/php5/apache2/php.ini (be sure to delete the temp.php file after you view it). Edit the upload_max_filesize, post_max_size, etc, and save the file. Then reload or restart Apache (or whatever web server you run) for the changes to take effect. On an Ubuntu server running Apache, I would use: sudo service apache2 reload

For those who don’t have root access, as typical in a shared hosting environment, you may need to contact your host to find out if (and how) you can make changes to PHP settings. For instance, some hosts allow you to create a php.ini or php5.ini to add settings, which is what a plugin like Upload Max File Size might assume.

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Comment