While managing your website, have you ever come up against an error that says “Fatal Error: Memory Size Exhausted?” It might have been even worse, with your website screen going completely white. You might have had these issues while installing a plugin, a new theme, or while upgrading your WordPress to the latest version. In other instances, your website could just be running very slow. The solution to all these problems is probably just one – increasing the memory limit in PHP.

These problems generally arise when the memory limit in PHP is lesser than what is required by the process. In such a scenario, you will need to increase memory limit WordPress.

How do you increase PHP memory limit

  • The easiest way is to contact your host

Increasing the PHP memory limit can be complex. If you are not tech-savvy, you might not want to do this yourself. It is always easy to get things done by professionals. You could get in touch with the hosting company and tell them about the problem that you are facing and they will help you out. However, if you feel that you can deal with these on your own and would not want the easy way out, the following options can help.

  • Increasing the memory limit from the php.ini file

Not all the shared servers allow their users to access the php.ini file. If you are allowed access, you can increase this memory limit directly through this file. If you do not have that access, you can create a duplicate php.ini file in your directory. This will enable you to alter the php memory limit. The data or values present in the duplicate file will override the original values from the main php.ini file. You will need to create the duplicate file and keep it in the directory where the WordPress website is installed. The following steps will help you generate a new php.ini file.

Log in to your Bluehost cPanel account and click on the PHP Config icon under Programming.

Finally, you will need to click on the Save Changes button before you exit.

However, if you are allowed to make changes to the files, here is what you can do.

  1. Go to the ‘Files’ section.
  2. Click on the File Manager icon.
  3. If you are prompted, choose Web Root. Otherwise, you can just navigate to the public_html folder.
  4. Right-click on the php.ini file and choose either the ‘Code Edit’ or ‘Edit’ option.
  5. Click on the ‘Edit’ button.
  6. Search for ‘memory_limit’. Do not, however, put this keyword inside the quotes.
  7. You can now enter the new memory limit for your PHP applications. It is never recommended to increase the limit beyond 128 MB.
  8. After you are done, click on ‘Save Changes’.
  • Using an FTP client for modifying the file

If you are using an FTP client, you need to follow these steps:

First of all, you will need to connect to the server through your FTP client and follow the given steps.

  1. Navigate to the public_html folder.
  2. Download the php.ini file.
  3. Open that file with a text editor.
  4. Search for the term ‘memory_limit’. Make sure you do not put the quotes.
  5. Enter the new memory limit for your PHP applications.
  6. Save the file.
  7. Upload the file using the FTP client.

 

  • Editing php.ini through wp-config.php

An alternative exists to changing the memory size. Instead of modifying the php.ini file, you can add a line in the wp-config.php file:

  1. ini_set(‘memory_limit’, ‘128M’);

This will increase php memory limit WordPress.

  • Changing the memory limit in wp-config.php

In case you are not able to edit the php.ini file and you are wondering how to increase PHP memory limit in WordPress, you can use the following method. You will need to add the following line in the wp-config.php:

  1. define(“WP_MEMORY_LIMIT’, ‘128M’);

This is yet another way to get your job done.

  • Making changes to the .htaccess file

If you have the .htaccess file, you can add a simple line of code to increase the memory limit:

  1. php_value memory_limit 128M

Here, you need to keep in mind that 128M actually means 128 MB. Now you can put an appropriate number according to your requirements.

So, when the time comes for you to increase memory limit in PHP, these are some of the methods that you can follow.

Author

Write A Comment