Allowed memory size of 8388608 bytes exhausted and WordPress shows a blank page

Hot WordPress

Recently I was setting up a WordPress blog for a friend of mine. What was supposedly to be completed in minutes took me much longer than expected. The installation didn’t seem to start at all but threw out a blank page in IE and in Firefox it asked me to save the installation file. What the heck… the WordPress was the latest 2.3.2 version already, so should be stable and good.

The hosting was on a Plesk server. In the error_log file, I found the following error message which was not alien to me.

PHP Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 233472 bytes) in /var/www/vhosts/domain.com/httpdocs/blog/wp-admin/includes/schema.php on line 103

I think this means that the server did not have enough memory to process the size of the data that it’s required to perform. The default memory alloted to PHP was 8MB and this was fairly small for big applications such as WordPress, especially if you have a lot of plugins. But I wasn’t sure why this also happened to a new installation with the default plugins.

Anyway, to resolve this problem, we have to hack the /wp_admin/install.php file (and not the schema.php file). Simply add the following snippet of code:

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

immediately after the code <?php at the top. This code increases the allowed memory to PHP to 32MB.

WordPress error

Oh yeah, of course you can try a lower memory size and work your way upwards if it still didn’t work. Try smaller sizes such as 16MB, 20MB, and etc, in multiples of 4MB. I didn’t have the patience so I tried 32MB straight. 🙂

Save the file. No need to restart the server and try the WordPress installation again.

That’s it. Now your WordPress should run just fine. It worked like a dream in my installation! Hahaha…

Note: Seems like this problem occurs more on servers with Plesk control panel. It never happened to me on my servers with CPanel.