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.


1 Answer 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.

  • The default upload_max_filesize is 2M, so you should try updating the settings in the main php.ini configuration file; see the edit on my answer for more details. This is not the php.ini file you may have created earlier and placed in your web folder (which only works if you have PHP configured to look for additional .ini files there). If you successfully update the main php.ini file, you don't need to add those settings to .htaccess, or run the Upload Max File Size plugin.
    – Gabriel
    Commented Feb 25, 2015 at 7:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.