How to Increase PHP Memory Limit in WordPress

WordPress allocates a certain amount of memory for its processes. If you receive errors such as "Fatal error: Allowed memory size of ... bytes exhausted", it usually means you need to increase the limit. Installing large plugins, themes with complex features, or image manipulation are all common scenarios that may require more memory.

To increase the memory limit in WordPress, you typically need to edit the "wp-config.php" file or the "php.ini" file or the ".htaccess" file. Here's how you can do it:

Method 1: Editing wp-config.php:

Open your WordPress installation directory via FTP or the file manager provided by your hosting provider, and locate the wp-config.php file.

Add the following line of code to wp-config.php, preferably just before the line that says /* That's all, stop editing! Happy publishing. */:

define( 'WP_MEMORY_LIMIT', '256M' );

You can replace '256M' with the memory limit you want to set, e.g., '512M' for 512 megabytes. Save the wp-config.php file after making the change.

Method 2: Editing php.ini:

The memory limit can be directly increased in the "php.ini" file on your server if you have access to it. Locate the line that has "memory_limit" set, and change its value. For instance:

memory_limit = 256M

Change 256M to the maximum amount of memory you want. Once the modification is made, save the php.ini file.

Method 3: Editing .htaccess

Also, you can increase the memory limit by editing the .htaccess file in your WordPress installation directory. Add the following line:

php_value memory_limit 256M

Replace 256M with your desired memory limit. Save the .htaccess file after making the change.

After making any of these changes, navigate to Tools > Site Health > Info in your WordPress admin dashboard to verify if the memory limit has increased. To confirm the new limit, look for the entry under "Server" for "PHP memory limit".

Note:
Remember that due to server resource limitations, you might not be able to raise the memory limit in some shared hosting environments beyond a particular amount. You should ask for help from your hosting provider if you run into any problems or have any questions.

Our WordPress Themes

Below are some of our premium WordPress themes. View all our free and premium WordPress themes →
EasyWP PRO WordPress Theme

EasyWP PRO

If you like EasyWP free WordPress Theme, you will love the premium version. EasyWP PRO is an user friendly, HTML5/CSS3...

$25.00
FineWP PRO WordPress Theme

FineWP PRO

If you like free version of FineWP WordPress Theme, you will love the premium version. FineWP PRO is an improved...

$25.00
MagShow PRO WordPress Theme

MagShow PRO

MagShow PRO is the premium version of MagShow free WordPress Theme with more advanced features. MagShow PRO version has 160+...

$25.00
GridFlex PRO WordPress Theme

GridFlex PRO

If you have used GridFlex Free WordPress Theme, then you will love the premium version. GridFlex PRO version has color...

$25.00
TidyMag PRO WordPress Theme

TidyMag PRO

If you like TidyMag free WordPress Theme, you will love the premium version. TidyMag PRO is easy to use, feature-rich,...

$25.00
TextWP PRO WordPress Theme

TextWP PRO

TextWP PRO is an more improved and advanced version of TextWP Free WordPress Theme. When compare with the TextWP free...

$25.00
PowerWP PRO WordPress Theme

PowerWP PRO

If you like PowerWP free WordPress Theme, you will love the premium version. PowerWP PRO is an easy to use,...

$25.00
GridNext PRO WordPress Theme

GridNext PRO

If you have used GridNext Free WordPress Theme, then you will love the premium version. GridNext PRO version has color...

$25.00

Can't you choose a single theme? Purchase All Themes for $75.

Save money with our low, one-time price for access to all of our 55 WordPress themes.