HW Image Widget example

This is an example of the responsive, user friendly HW Image Widget available for WordPress 3.5 and up. Its free for download from WordPress.org.

Did you know it sports the TinyMCE WYSIWYG editor for the text?

WEB ARTISAN

Development by Håkan Wennerberg

WordPress memory limits – going beyond 256M

WordPress (currently 3.5.1) limits the memory usage to 32M for single-site installations and 64M for multi-site installations on the front-end. In the back-end it is set to 256M (if possible) by default. This is done in the PHP-code, it means that your current web server setup needs to allow setting php.ini variables from code.

So to increase the amount of memory allowed above 256M you will first need to make sure that PHP-code is allowed to change php.ini settings. In Apache this is typically done by defining the “AllowOverride Options” or “AllowOverride All” in your vhost-file.

However, no matter how much memory you define in php.ini or .htaccess, WordPress will never set a higher value then 256M. Why? Because there are two constants that defines this behavior.

Define the following two constants in wp-config.php to set the amount of memory that WordPress should be allowed to use:

// Front-end
define( 'WP_MEMORY_LIMIT', '512M' );
// Back-end
define( 'WP_MAX_MEMORY_LIMIT', '512M' );

Why do I need more then 256M of RAM? Well, if you are asking that question, you probably should not change this value. But if you, like me, are hitting some memory limits due to long running tasks, you might not have an option but to raise the amount of RAM available to WordPress (PHP).

Written by Håkan Wennerberg

Håkan (also known as PuffyThePirateBoy) is a systems architect based in Lundsbrunn, Sweden. Currently focusing on web development, Håkan is passionate about all aspects of web engineering ranging from back-end system infrastructure to front-end UX.

Outside of work, Håkan has a (slight) obsession about motorcycles and constantly trying to figure out how to get money for a bike, and what model it should be :)

Comments

Feel free to leave a comment using the form below.

Johnny
March 8, 2013 at 2:08 AM

define( ‘WP_MAX_MEMORY_LIMIT’, ‘512M’ ); Worked for me running 3.5.1. define( ‘WP_MEMORY_LIMIT’, ‘512M’ ); did not. Thanks for the tip!! Saved loads of time.

Reply
HÃ¥kan Wennerberg
March 8, 2013 at 1:28 PM

Article needs a bit of clarification. The WP_MEMORY_LIMIT applies to front-end only, while WP_MAX_MEMORY_LIMIT affects the back-end.

Reply

Leave a Comment

Your email address will not be published. Required fields are marked *