WordPress Fatal Error – Allowed memory size of x bytes exhausted

If you frequently see this error on WordPress and you’re getting fed up, it’s time to do something about it.
If you’re using cPanel, here’s how you solve the problem.

Generating a new php.ini

Click the PHP Config icon under the Software/Services category.
Under Install Default php.ini, check IonCube and SourceGuardian (required by many commercial PHP scripts)
Click the INSTALL PHP.INI MASTER FILE button in the same category
Now we have to rename php.ini.default to php.ini – Under cPanel’s Files category, choose File Manager.
You should get a pop-up titled File manager directory selection
Select Web Root (public_html/www) and Show Hidden Files (dotfiles) and then click Go.
This is the chance to backup your old php.ini if you have one
Right-click on the new php.ini.default and click rename.
Edit the name to php.ini and click Rename.
You now have a new php.ini

Editing your php.ini

To edit your php.ini, you right click it and choose Edit.
You will be able to edit key/value pairs. To increase the memory limits, etc., do the following:

Change memory_limit from 2M to something like 50M
Change register_globals to On
Change the maximum size for uploading. This one has two keys – post_max_size and upload_max_filesize.
To enable PDO, add the following lines:

Finishing off

The system will take upto 15 minutes to recognise the changes in your php.ini, so be patient.
Also, php.ini is directory specific. So unless you’ve turned on the PHP5 (Single php.ini) or PHP5 (FastCGI), you’ll have to copy php.ini into all the subfolders in your public_html directory.

There could be many subdirectories you’ll have to copy it into, so watch your step.

Now your wordpress should upgrade without complaining!

The Latest

To Top