How to Change PHP Memory Limit in cPanel?

How to change PHP memory limit in cpanel 1

Today we will take a look at the “error” with regards to the memory limit of the PHP in the cPanel.

We will also discuss an easy and quick solution for the same.

It is not a complex process, and it simply requires access to cPanel hosting account. 

What is the Reason for this PHP Memory Limit Error? 

Sometimes upon execution of PHP scripts, you may notice it returns with; ‘Fatal error:…’. This sort of error occurs when the memory amount allocated to a PHP script gets exhausted.

As a result, the script is unable to complete its execution. This is called Memory Limit Error in PHP.

The memory_limit term in the settings of your server’s PHP determines how much memory the PHP has.

The cPanel will help you to make changes to the value according to your preference.

We will discuss a simple way to get it done.

Fixing the Issue 

You will need to log into the cPanel account by utilizing the cPanel username as well as password.

If you cannot recall your password, you will come across the option to reset the password on a similar page.

All PHP installations have default settings. Sometimes it requires editing as per the requirements of a website. WP has a memory limit of 32MB by default.

We have noticed that for many websites, 128 MB is sufficient unless the theme or plugin that is installed has increased requirements.

In such a case, you will come across a fatal error. This error mainly occurs when you activate and install themes and even while uploading images.

If this happens, you will need to enhance the limit of that specific website’s memory.

There are 2 solutions to increase PHP memory limit;

  • You can increase PHP memory limit via the Multi-PHP INI editor
  • You can increase PHP memory limit via the wp-config file

Procedure to increase PHP Memory Limit through the Multi-PHP INI Editor

Log-in: You must first log in to your cPanel account. Then log in to that particular website that needs an increase in PHP memory limit.

Multi-PHP INI Editor: The moment you log in, you need to search for a Multi–PHP INI Editor. It can be located below the section of the software. 

Basic Mode: Within the Multi-PHP INI Editor, you will find two modes, and they are; Basic Mode and Editor Mode. You must select Basic Mode.

You will find this in ‘Configure PHP basic settings’. The PHP configuration editor can be opened by choosing the domain root document.

PHP Directives: The list of directives can be viewed. For this, you must enter the max limit that the site requires in the directive – ‘memory_limit‘.

Once you’ve completed the above steps, you must select Apply, and the changes that are made will be saved. 

Procedure to increase PHP Memory Limit through wp_config

Log-in: You must log in to your cPanel account, mainly to the site for which you require an increase in the PHP memory limit.

File Manager: Look for the File Manager and select it.

Scroll to public_HTML: Once you enter File Manager, scroll to public_HTML. 

Wp-config: Once you go to the public_HTML, you will come across the file wp-config. As you do, right-click it in order to edit the file. You must look for the line “/* and look no more, stop editing and Happy publishing”/*. 

Now you must add this particular line define (‘WP_MEMORY-LIMIT,’ ’64M); this must be added above those lines. 

And now, finally, select the option Save Changes


These are two simple steps that will help you to increase PHP Memory Limit. We do hope that this article has helped you. Do feel free to share your thoughts and comments with us.

That’s all, for now, we’ll see you soon with our next article. You can also check our article on How to Redirect a Domain without Hosting?

Leave a Comment