How to increase Wordpress memory on Ubuntu?

July 12, 2015 1.8k views
WordPress DigitalOcean


I tried to follow this guide:

But . .. I can't find the wp-config.php file in '/var/www/'. Screenshot here:

I had a search and found 'wp-config.php' in '/var/www/html', but I'm not sure if that is the right one. Either way, adding 'define( 'WPMAXMEMORY_LIMIT', '256M' );' to that file didn't seem to make a difference.

Any ideas?

3 Answers

You can do from within your php.ini file.

sudo nano /**YOUR**/**PATH**/**TO**/php.ini

Press Ctrl+W and search for uploadmaxfilesize ,set it to your desired size


Press Ctrl+W and search for postmaxsize ,set it to your desired size, which needs to be at least the same size or larger than uploadmaxfilesize


Save / Exit
CTRL+X, Then Y, Then Enter

Restart PHP

Good luck! :)

Depends on where you have installed wordpress ofcourse. If wordpress is installed in /var/www/html your wp-config file will be there. If you like to increase the memory, you will have to edit the wp-config.php with define( 'WP_MEMORY_LIMIT', '96M' ); for example.
You need to make sure you got enough memory for this and you got the proper php.ini configuration. If not, you need to allow php in the ini file to use enough memory. You can find out more about that online.

When in the administration area, the memory can be increased or decreased from the WPMEMORYLIMIT by defining WPMAXMEMORY_LIMIT. You can therefor use

define( 'WP_MAX_MEMORY_LIMIT', '256M' );

Please note, this has to be put before wp-settings.php inclusion.

  • Many thanks :). Yes so as you say, if you use the WordPress application installation on Digital Ocean then the WordPress installation will be at /var/www/html

    I added define( 'WPMEMORYLIMIT', '96M' );

    I think the problem was that before I forgot to put the 'm' after 96 so I had only 96 bytes of memory.

    Thanks for the help and reassurance, much appreciated!

Have another answer? Share your knowledge.