increasing the media file upload limit

I’m running WordPress 4.0 on Ubuntu 14.04 on an EC2.

I see this is a common issue, but I’ve been unable to change the file upload limit from 8MB to anything.
I’ve tried these suggestions:

  1. Change the max upload line in your php.ini file
    (/etc/php5/apache2/php.ini and/or /etc/php5/cli/php.ini)
memory_limit = 128M
upload_max_filesize = 128M
post_max_size = 128M
file_uploads = On

I’ve tried smaller integers also.

  1. Create the PHP.ini file in the wp-admin directory.
  2. Open or create the .htaccess file in the root folder and add the following code:

php_value upload_max_filesize 128M
php_value post_max_size 128M
php_value max_execution_time 300
php_value max_input_time 300
  1. Add the following code in the theme function’s file:
@ini_set( 'upload_max_size' , '128M' );
@ini_set( 'post_max_size', '128M');
@ini_set( 'max_execution_time', '300' );
  1. Copy the php.ini file in wp-admin to php5.ini.

At every try I’ve reloaded apache2 and I’ve even rebooted the machine. Everything is up to date. I’ve disabled all my plugins, and tried different themes. I’ve even re-installed wordpress. I’m really stumped. Any more suggestions?


This stackoverflow suggestion to make a plugin worked:
increase max upload limit in wordpress

Create a file called increase-upload-limit.php in wp-content/plugins/increase-upload-limit/ and write this:

<?php
/* Plugin Name: Increase Upload Limit */

add_filter( 'upload_size_limit', 'b5f_increase_upload' );

function b5f_increase_upload( $bytes )
{
   //return 33554432; //  32 mebiBytes 
    return 134217728; // 128 mebiBytes
}

Then go to wp-admin and activate it.

Note that the PHP file doesn’t have the closing angle bracket. That’s how it works in WordPress for some reason. I’ll have to find out why eventually.

One thought on “increasing the media file upload limit

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.