Written by nitinpai on July 18th, 2007
WordPress Error – “Allowed memory size of 8388608 bytes”
You sometimes might get the following error if you are trying to import a previous blog into a newly installation of WordPress through an RSS feed or while installing a new plugin as:
Allowed memory size of 8388608 bytes exhausted (tried to allocate xxxxx bytes)
This means that the server is not allowing to process the size of the data than its maximum alloted size. Remember that there is nothing wrong with the WordPress installation. Its the matter of the amount of data that the server can process at one time.
Don’t be scared, you can get it resolved in a matter of seconds. There are two ways of resolving this error.
Method #1 : Without Restarting the Server
If the error mentioned appears during the importing, what you need to do is get access to the source code of the WordPress where you have done the installation.
Once you get the access you will need to modify two files . They are:
Now copy this line of code:
This line increases the server processing capacity by the included size i.e 16M. Paste the above line in the import.php file just after the line of code:
Now in the second file i.e. wordpress.php paste the code after the line of code:
Note: If the error mentioned appears during the installation of a plugin then make a note of the path and the .php page which is given out in the error and paste the same line in the mentioned .php page.Remember, the code must be pasted within the php code block i.e in between <?php and php?> in the page since it is to be executed by the server.
Now once again access your WordPress URL and go to the manage > import menu and try importing. If your problem still remains, just keep increasing the size mentioned in the pasted code in multiples of 4 i.e. in place of “16M”, try “20M”, “24M” etc.
Method #2 : Which Requires a Server Restart
If you want to eliminate this error once and for all then you need to target your server to make the changes. But you should have the permissions to restart the server.
If you have this permission then go to the server installed path and search for the file php.ini file. In this file there will numerous things mentioned. But all you have to do is search for the term “memory_limit“. Change the value of this variable from 8M to either 16M, 24M, etc as required.
Save the file and restart your server. The error will be resolved once and for all. Good luck!