Increasing the PHP Memory Limit of Your Website

No results found. Try again with different words?

Search must be at least 3 characters.

    Increasing the PHP Memory Limit of Your Website

    Have you ever come across an error that says: Fatal Error: Memory Size Exhausted? Or maybe your website just went white screen? This usually occurs when you install a new theme, plugin or upgrade your WordPress to the latest version. Or maybe the site is running just too slow?

    The main cause of this error is that the PHP memory limit of your host is lesser than the process actually needs. In such cases, you will need to increase your host memory limit, so that the process gets completed. You can increase your host memory limit by following any of the five methods mentioned below.

    1. Most Recommended: Just Contact Your Host
    Increasing the PHP memory limit is complex and the process differs from hosts to hosts. So it is always better to get it done from someone who knows it well. So just get in touch with your hosting company and they will be happy to do it for you.

    2. Increasing Memory Limit via PHP.ini file
    Many small shared hosted servers do not allow users to access the PHP.ini file. If you are granted access, you can directly increase the memory limit through this file. If not, you can ask your host to allow you to create a duplicate PHP.ini file in your directory. The data or values in the duplicate file will override those in the original PHP.ini file. You can create a duplicate file named PHP.ini in the directory where your WordPress website is installed. If you wish to extend the limit to 256MB, you can enter the following line of code:

    memory_limit = 256M;

    3. Alternative to editing PHP.ini through wp-config.php
    This is another alternative to the PHP.ini method. Simply add the following line in the wp-config.php

    ini_set('memory_limit','256M');

    4. Changing memory Limit in wp-config.php
    In case you are not able to edit the PHP.ini file, you can use this method that helps increase memory limit through the wp-config.php. You can add the following line of code in your wp-config.php file.

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

    5. Modifying the .htaccess file
    Some of you might have the .htaccess file where you can simply add a line of code to increase the memory limit.

    php_value memory_limit 256M

    P.S: 256M in the above code samples mean 256 MB. Feel free to change this to any appropriate number.

    Was this article helpful?
    Did not find a solution? We are here to help you succeed.

    Related Docs

    Scroll to Top

    Download is Just A Click Away!

    Be among the first to try the beta version of Astra’s Header Footer Builder. Filling the form will ensure you’ll be the first to learn about updates and features.

    Download is Just A Click Away!

    Enter your email address and be the first to learn about updates and new features.