How to Increase PHP Memory in WordPress

While utilizing WordPress, there are a couple of frequent issues or errors that you simply might need to deal with. Among the commonest is the WordPress reminiscence restrict error, often known as a “PHP reminiscence restrict error”.

The PHP reminiscence restrict error is usually one of many simpler WordPress errors to repair as a result of you understand precisely what the issue is: sure scripts in your website don’t have entry to sufficient reminiscence. The resolution is solely to enhance your reminiscence restrict, and there are a number of methods to do that.

Below, we’ll talk about two simple strategies.

Solution 1: How to Increase PHP Memory Limit in the WP_Config File

The first place to strive is the wp_config.php file of your web site. This file incorporates the fundamental configuration particulars to your web site, together with its PHP reminiscence allocation. Increasing your PHP reminiscence restrict from right here is often sufficient to resolve the issue.

You’ll discover this file in the basis folder of your WordPress website. You can entry this via File Transfer Protocol (FTP) or by utilizing cPanel.

Screenshot of FTP interface in cPanel

You will want to present the related particulars as prompted on the display. These shall be:

Login — your required username

Password — any password of your selecting

Directory — the listing you desire to to entry. In this case, this shall be your root listing, so enter ‘public_html/’.

NB: In most circumstances, your internet hosting supplier will give you FTP particulars by default so make sure to test with them earlier than you create a brand new FTP account.

Accessing your Root folder Using FTP

If you’ve by no means finished this earlier than, the very first thing you want to do is set up an FTP consumer. To set one up, you’ll want your web site’s FTP credentials. Typically, yow will discover these credentials in your internet hosting account. If you face any difficulties, nevertheless, merely attain out to your internet hosting supplier and so they’ll present you the place to discover them.


Alternatively, you’ll be able to create your FTP account your self. Login to cPanel then navigate to Files Manager > Files > FTP Accounts.

Once you might have your FTP consumer arrange, you’ll be able to entry your website’s information. To begin with, you may want to discover your website’s root folder. For WordPress web sites, it will often be a folder known as public_html. It might also be a folder with the title of the web site. Once in, you will note a file named wp-config.php.

You’re going to have to make some adjustments to this file, however you may want to train a little bit of warning as any errors could doubtlessly break your web site. Before you go any additional, back up your website as a safeguard.

After backing your website up, open the wp-config.php file and search for this line:

outline( ‘WP_MEMORY_LIMIT’, ’40M’ );

The worth, 40M, could be completely different for you relying in your internet hosting service. It’s additionally attainable for this line not to seem in any respect.

Screenshot showing how to edit the PHP memory limit in the wp-config file

If you do discover it, merely change the worth. 256M is often sufficient reminiscence to help just about any sort of web site.

If you’ll be able to’t discover this line, search for the road that claims: “That’s all, cease modifying! Happy running a blog.” Then paste the identical code proper above it:

Screenshot showing how to increase PHP memory in the wp-config file

Save your adjustments, and your web site ought to be again working as regular.

If you retain getting the identical error message after a couple of tries, nevertheless, then it’s probably that you simply’ve exceeded the utmost restrict allotted by your internet hosting service. In this case, you may want to contact your internet hosting service to ask for a restrict.

Screenshot of the file manager section in cPanel

Just like with an FTP consumer, you’ll be able to entry the wp-config.php file via cPanel. Start by logging in. Scroll down to Files > File Manager > Public_html > wp-config.php. Once you discover it, right-click and choose Edit.

This will open up the wp-config file in cPanel’s native editor. Follow the identical steps outlined above for modifying the wp-config.php file to enhance your PHP reminiscence restrict.

While modifying the wp-config file is often the popular technique for rising the PHP reminiscence restrict, there are some various strategies that you must learn about.

As we have demonstrated, you’ll be able to enhance your website’s PHP reminiscence in the wp-config file in cPanel. There are different choices inside cPanel that permit you to modify PHP reminiscence too. One of them is the PHP selector software.


Once in cPanel, scroll down to Software > Select PHP Version > Options.

Screenshot showing how to increase PHP memory allocation using the PHP selector

In the ensuing interface, scroll down to memory_limit and choose an applicable determine.

Note: This choice is probably not out there for all internet hosting companies.

Alternative Solutions: Use Better Web Hosting

The quantity of house and reminiscence you get entry to is determined by your internet hosting supplier and the internet hosting plan you pay for. Most new web site homeowners go for cheaper shared internet hosting plans which will allocate little PHP reminiscence.

While that is often not an issue at first, you’ll inevitably attain the restrict as your web site grows and also you begin including extra plugins.

If you adopted the steps above to enhance your web site’s PHP reminiscence restrict and ended up unsuccessful, likelihood is, you’ve exceeded the reminiscence allowance of your internet hosting plan.

Depending in your circumstances, you might need to select a distinct internet hosting plan, change to a brand new internet hosting supplier, or improve to a better tier. Whatever the case could also be, make sure to choose a dependable host that you may rely on to provide you with entry to high-quality sources.

Access More Storage Space by Increasing Your PHP Memory Limit

The PHP reminiscence restrict error is without doubt one of the extra generally occurring errors on WordPress. If you utilize low-cost internet hosting plans, have a number of plugins performing advanced capabilities, or in case your web site is rising at a quick charge, you are probably to encounter this error sooner reasonably than later.

Increasing your website’s reminiscence restrict via the wp-config file is a simple and free resolution, however the simplest way to forestall a PHP reminiscence error from occurring in the primary place is to use a dependable internet hosting supplier and a strong internet hosting plan. Not solely will this provide you with higher reminiscence allocation choices, it will additionally provide you with entry to different high-quality sources that may enhance the general efficiency of your website.

The Best WordPress Hosting Providers

Launching your own WordPress site? Here are the best WordPress hosting providers to minimize headaches and maximize performance.

Read Next

About The Author

Related Posts