Fatal error: Allowed memory size of 67108864 bytes exhausted

WordPress uses memory. Plugins and themes use memory. New versions of software may use more memory than before. When that happens and PHP on your server doesn’t have enough memory then PHP will stop with a fatal error like this:

Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 1203208 bytes) in /home/*****/public_html/wp-admin/includes/class-pclzip.php on line 4215

This happens quite a bit but it’s not a bug in WordPress or your new plugin or theme, you simply need to let PHP use more memory on your server. Thankfully WordPress makes it easy to do this. You must define a constant, WP_MEMORY_LIMIT in your server’s wp-config.php like this:

define(‘WP_MEMORY_LIMIT’, ‘128M’);

The error message will give you an idea of how much memory is required. The error message says it tried to allocate 1203208 bytes or just over 1MB of memory. The limit here is 67108864 bytes, or 65536KB which is 64MB so here I’d need a WP_MEMORY_LIMIT of more than 66M. The error message will go away once PHP has enough memory but be sure to test it.

If you allocate too much memory your server could start eating into disk swap space. Also be aware that each Apache child process is allowed to use that much memory so if you had ten processes it could use ten times the memory limit in a worst case scenario. If that happens you’ll need more RAM or you’ll have to figure out what’s using so much memory.

There’s also a WP_MAX_MEMORY_LIMIT constant. By default it’s 256M and it’s currently only used when uploading images.

On the off chance that you don’t have WordPress installed and you came here from a search engine, then you’ll want to use ini_set() somewhere early in the PHP process to increase the memory limit:

ini_set(‘memory_limit’, ‘128M’);

Finally, I love that the wp-config.php codex page is the first result of a search for WP_MEMORY_LIMIT.

The amazing self charging Android phone

image

Some things never change. Both Android phones I’ve owned (Samsung Galaxy S 1 & 2) have this weird bug where the phone turns itself off and when reset by removing the battery the charge level has gone way down.

I woke early this morning to discover the PIN unlock screen so I guessed the phone had rebooted. When I checked the battery levels I saw this. The battery suddenly lost a huge chunk of charge sometime during the night but over the next few hours seemed to recharge itself.

I’d say it’s magic.

Robot Enrichment

I just noticed that Portal 2 now has a store where you can modify your robot. I like the way Valve monetize their games. They bring out free DLC, expanding older games with updates and offering them either free (TF2) or at a steep discount. Then they encourage you to buy hats and personalise your character! Nothing like some of the other grind to play free games I’ve played elsewhere.

Two games spring to mind, both free Android games. Samurai vs Zombies and Garfield Defense. Both play in exactly the same way even though they are apparently by different developers. I swear they used the one game engine and just swapped out graphics and sound.

In both games you collect coins to purchase power ups but those purchases are fairly pricey and by the time you get to level 10 you’ll need to grind and play the level 4 or 5 times to get enough coins to buy an upgrade to finish the level.

Still, not a bad way to spend a few minutes while waiting for the bus or something but to be honest I’d rather use my phone to read a book!

I almost forgot to mention the iOS version of Plants vs Zombies. It received a few updates recently which added the ability to plant flowers that reward you with silver and gold. I only tried it briefly but soon discovered that you need to use fertilizer or the plants will wilt. Of course you have to use real money to buy the fertilizer. *sigh*

Super Cache for the Weekend

WP Super Cache 1.0 came out several months ago and while it worked fine for most people there’s always room for improvement and bug fixes. Here are some of the bug fixes and improvements coming in the next version which I plan on releasing next week.

There are a lot of changes there so if you have a self hosted blog I would really appreciate if you download the development version, wp-super-cache.zip and install it in your plugins folder.

  • Use $_SERVER[ ‘SERVER_NAME’ ] to create cache directories.
  • Only create blogs cached directories if valid requests and blogs exist.
  • Only clear current blog’s cache files if navigation menu is modified
  • Added clean_post_cache action to clear cache on post actions
  • Removed garbage collection details on Contents tab
  • Added wp_cache_check_mobile cacheaction filter to shortcircuit mobile device check.
  • Don’t delete cache files for draft posts
  • Added action on wp_trash_post to clear the cache when trashed posts are deleted
  • Show a warning when 304 browser caching is disabled (because mod_rewrite caching is on)
  • New check for safe mode if using less that PHP 5.3.0
  • Added wp_supercache_remove_cookies filter to disable anonymous browsing mode.
  • Fixed garbage collection schedule dropdown
  • Fixed preload problem clearing site’s cache on “page on front” sites.
  • Fix for PHP variable not defined warnings
  • Fixed problem refreshing cache when comments made as siteurl() sometimes didn’t work
  • Preloading of taxonomies is now optional
  • Domain mapping fixes.
  • Better support for https sites. Remove https:// to get cache paths.
  • Added AddDefaultCharset .htaccess rule back in and added an option to remove it if required.
  • Added multisite plugin that adds a “Cached” column to Network->Sites to disable caching on a per site basis.
  • Added WPTouch plugin to modify browser and prefix list in mobile detection code. Added support for that plugin’s exclude list.
  • Fixed cache tester
  • Filter the tags that are used to detect end-of-page using the wp_cache_eof_tags filter.

Harness racing on Cork’s roads

Two harness racers on the Cork to Mallow road defying Garda attempts to stop them and driving against traffic on a very busy road. Crazy guys, crazy.

More on Reddit and Silicon Republic.

This comment has received too many negative votes
Look lads there are races on that road all the time with horses and no harm done it was the Garda? that caused the madness forcering the pony to the other side of the road it 2 horses on the right side of the road for 2 mile the first 1 finish first wins but the Garda fucked it all up

MrFastpony 1 hour ago

This comment has received too many negative votes
For all ye stupid fucking? cunts that have Notting better to do but call names what about all the junkies and prostitute and rapiest n child malisters of settle people ya never hare about travellers up on court for any of that so who is the real scumbags here I think it the settle kind

MrFastpony 6 hours ago