Diwakar Academy

  • Home
  • WordPress
  • About Us
  • Contact Us
You are here: Home / WordPress / How to Increase WordPress Memory Limit: Four Methods

August 24, 2023

How to Increase WordPress Memory Limit: Four Methods

Spread the love

Are you facing difficulties with the increase WordPress memory limit on your WordPress website? A common problem that can affect WordPress sites is the “PHP Fatal error: Allowed memory size of 26843546 bytes exhausted.” There are various reasons why PHP might run out of memory in WordPress, but usually, it’s because you’ve reached the memory limit set by PHP in your hosting. The good news is that you can increase the WordPress memory limit by using a setting in your wp-config.php file.

Table of Contents

Toggle
  • Method 1: Increase PHP Memory Limit in WordPress
  • Method 2: Increase the PHP Memory Limit in PHP.ini
  • Method 3: Increase the PHP Memory Limit using .htaccess
  • Method 4: Ask Your Host for Help

So, if you’re encountering a serious PHP error like the one shown below, you’ve come to the right spot:

Method 1: Increase PHP Memory Limit in WordPress

To make the PHP memory limit bigger in WordPress, you’ll have to know a bit about FTP and changing PHP files. First, log in to your server’s FTP to access your website’s wp-config.php file located in the main WordPress folder. If you put the code below in that file, it will raise the memory limit to 256 megabytes (MB). This amount should be plenty for most WordPress websites.

<?php

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

By default,  WordPress memory limit is 32 MB

Method 2: Increase the PHP Memory Limit in PHP.ini

If the previous method doesn’t work, you might have to change the memory limit by editing a file called “php.ini” on your server. To do this, find the line that says “memory_limit” in the “php.ini” file and make the change there.

memory_limit = 256M;

Want to locate your server’s php.ini file? You can use the phpinfo() trick to discover where your server’s php.ini is kept.

Method 3: Increase the PHP Memory Limit using .htaccess

You can change the PHP memory limit on your WordPress website using the .htaccess file. Just put a line like ‘php_value memory_limit’ in the .htaccess file to adjust the PHP memory limit for your site.

php_value memory_limit 256M

After you make this change, you’ll probably have to restart apache for it to work. Also, remember that, just like the other methods mentioned, your web hosting service might stop this from working.

Method 4: Ask Your Host for Help

If you can’t change these files yourself, the best thing to do is get in touch with the people who provide your hosting services. You can ask them to raise the memory limit for you. Most hosting providers are happy to help with this.

Some hosting providers might even have their own control panel where you can adjust the memory limit without having to mess with any files. You should ask them if this is an option.

If none of these ways to change the memory limit on your WordPress site work, don’t worry. You can also contact your web hosting company for more assistance. There might be a problem with the code on your site or something your web host has set up that’s affecting it.

Related Articles

  • How to Add NoFollow Links to WordPress Menu
  • How to View Word Count in WordPress for Any Post or Page

Article by Diwakar Academy / WordPress Leave a Comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

  • Home
  • WordPress
  • About Us
  • Contact Us

Copyright © 2025 · All Rights Reserved · Terms and Conditions · Privacy Policy