How to Change WP_MEMORY_LIMIT on WordPress 3.1

How to Change WP_MEMORY_LIMIT on WordPress 3.1


The tips and trick How to Change WP_MEMORY_LIMIT on WordPress 3.1 because there's a story behind it ๐Ÿ™‚

Today when I'm trying to login to one of my wordpress website, there's an error inside the wp-admin page Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 122880 bytes) in /myphpfile.php on line 127

I tried to Googling how to increase the memory limit that has been set up by WordPress….and the result, all of the tutorial I've got from internet tells that WP_MEMORY_LIMIT is inside wp-settings. I tried to searching into that file but I found nothing!

Actually on WordPress 3.1 the WP_MEMORY_LIMIT configurations is located at wp-includes/default-constants.php

	global $blog_id;

	// set memory limits
	if ( !defined('WP_MEMORY_LIMIT') ) {
		if( is_multisite() ) {
			define('WP_MEMORY_LIMIT', '64M');
		} else {
			define('WP_MEMORY_LIMIT', '96M');

There's the memory limit value to change into your most suitable.

Hope this helps…:-)

(Visited 351 times, 1 visits today)

Share this article if you found this post was useful:

Blogger at Love PHP, offensive security and web.
Contact him at me[-at-]

See all posts by || Visit Website :

  • Thanks man. This was a real lifesaver for me on a Laughing Squid install where I don't have access to the php.ini file. 

    • v4L

      LoL….you have the same problem with me… ๐Ÿ™‚ nice to know your problem solved

  • Yon

    Thanks, Thanks, Thanks. It's really worked!!

  • marjus

    my wordpress 3.3.1 not work fine, because php memori host is 16mb 
    what can i do? to increasing memory php of my host?

    • v4L

      if the problem was at your hosting provider, it’s better contact them and ask solution about your problem…

  • it’s really worked…thanks so much ๐Ÿ™‚

  • Nick

    It worked!!! Thank you so much ๐Ÿ™‚

    • v4L

      you’re welcome

  • thanks !

  • Pingback: WordPress, WooCommerce, and the elusive WP_MEMORY_LIMIT issue « Lewis' Blog()

  • Arun yadav

    i was searching this for days ,,,and u save a lot of my time .. thank u very much

  • thanks..
    but i other pblm… how can i change default upload size [themes,plugins] in wordpress?

  • thanks! this helped quite a bit. much appreciated.

  • Lucian

    Thank you! I gave up on this the first time I tried, because I ended up messing up my webpage by editing the wp-settings and wp-config files.
    But this seemed to do the trick for me!