How To Increase The Memory Limit Of PHP and WordPress?

November 9, 2021 / WordPress

WordPress is a powerful content management platform which has different themes and plugins.  With the help of this interactive themes ,  you can easily create an interactive and effective website in just a few steps.

If your WordPress Website has large amount of media content or running long scripts then you will get the errors like –

Fatal error:  Allowed memory size of 33554432 bytes exhausted?
Fatal error: Out of memory.

It means that more memory is required for your WordPress code than the default amount. However, resolving this problem is not as difficult as it would appear, and technical knowledge is not essential.

 

Default memory limit for WordPress :
32 MB , however this is not sufficient at times, especially if the incoming traffic increases.

 

There are 4 ways that you can use to increase php memory limit and uploading limit in WordPress.

  1. Edit wp-config.php file
    This file is located in the root directory of your wp file system and it contains your basic configuration information. This file can be edited through SSH or the File Manager by adding the line mentioned below in the wp-config.php file.define(‘WP_MEMORY_LIMIT’, ’64M’);
    The limit mentioned above can also be setup up to 128 MB.
  2. Edit PHP.ini file
    If you don’t want to edit wp-config.php file , then editing PHP.ini file is alternative way to do this.
    You can find the PHP files on the cPanel severs at the following location:/etc/php.ini
    Find the line mentioned below in the file:
    memory_limit =
    Determine the memory limit in accordance with your needs.
    memory_limit = 64M

    In case you have two WordPress blogs of 64 MB each, you can go ahead and set the PHP memory limit to 128 MB as displayed below:
    memory_limit = 128M

  3. Edit .htaccess file
    Be careful while editing your .htaccess file –
    add this piece of code in your filephp_value memory_limit 256M
    php_value upload_max_filesize 12M

    If you try to make any changes in the .htaccess file, there are possibilities of your WordPress site/ blog getting corrupted. So It is always recommended to take backup the WordPress data before you make any changes in the WordPress file.

  4. Contact to your Web Hosting provider
    If you don’t want to take any risk you can simply connect with your web hosting provider. they will give suggestions on your problem.
    other than this , you can also upgrade the hosting plan so that you will get more resources to running your site efficiently .

If you have any other inquiries or if the solution you chose didn’t work, don’t be hesitant to get in touch with our team.

 

Dominos Search