How to Increase PHP Memory Limit on WordPress

How to Increase PHP Memory Limit on WordPress

August 11, 2018 By Xtremerain Editorial Team

    There are so many themes and plugins for wordpress platform. It is the most popular CMS. But sometimes, Users may face some difficulties including some errors. Users may encounter white screen of death or any other errors. It may have many reasons. But one of the most common reasons is PHP memory limit.

    Why You should Increase WordPress PHP Memory Limit:

    If you have less php memory limit, You may encounter fatal error for specific themes or plugins. If you use multiple plugins you should increase it. If you use heave weighted plugins, You mus increase it. Otherwise, Your website won’t perform well. Same for heavy weight themes. For example, I installed NewsPaper theme for one of my website. It has so many functions. But it was not performing well. Settings could not be configured correctly. At last i noticed that this theme requires high PHP memory limit. Most of the wordpress site admins use Yoast SEO, Jetpack and other plugins. These two plugins mentioned are not lite weighted. So, It is better to increase your php limit. Now you will know the correct ways to do it.

    How to Increase PHP Memory Limit on WordPress: 

    This is very easy process. You can do it by following two methods. Let’s know –

    Method 1: From WP-Config.php

    This is the easiest method. You just need to edit your wp-config.php file. You will find it on your public html folder. Just follow the steps below –

    • At first login into your Cpanel account or FTP account.
    • If you are in cpanel, Go to File Manager.
    • Now go to public_html folder.
    • Now find wp-config.php. Open or download it.
    • Now, Open it with Notepad or Notepad++.
    • After 48th line place the line given below –
    /** Memory Limit */
    define('WP_MEMORY_LIMIT', '96M');
      • You will place the above line just before this lines –
    * WordPress Database Table prefix.

    php limit code wp config

    • Now save it and upload it via ftp to replace existing wp-config.php.
    • Done.

    *** I’ve followed this fist method to increase php memory limit.

    Method 2: By Creating php.ini File

    This is an older method. This is also very easy to do. Just follow –

    • Go to public_html > wp-admin.
    • Find php.ini. If you see this file is already exist, Edit it and replace this line
      memory_limit = 96M ; Maximum amount of memory a script may consume (96MB)
    • If you have not php.ini file. Just create it and add this line
      memory_limit = 3000M
    • Save and Done.

    If you have any question, You can ask me. Sometimes, These methods above may not work for some hostings. In that case, You will need to ask your hosting provider.