How to Change PHP Memory Limit in cPanel?

When you need to change your PHP configuration, you will be rerouted to your server known as PHP.ini to edit a specific ini file, to expand the PHP Memory Limit (memory_limit).

Through PHP, you can manage the Memory Limit settings; PHP scripts may consume the maximum memory. The value can be set to a minimum of post_max_size.

Note that every PHP installation has a default setting.

In some cases, it needs to be edited for the website. WordPress memory limit by default is 32 MB; 12 MB is sufficient for some sites unless the theme/plugin installed demands more.

At times you may find an error like Fatal error Allowed memory size of 23556632 bytes exhausted (tried to allocate 3349917 bytes) in /home/xxxxx/public_html/wp-includes/plugin.php online xxx, or Allowed Memory Size.

This kind of PHP memory limit error is mostly found while activating and installing themes or while uploading images.

In such a case, you will have to increase the memory limit for that particular website.

Two Ways to increase PHP Memory Limit in cPanel

You can increase the PHP memory limit very easily by way of the below mentioned PHP options:

1) The PHP Memory limit can be expanded through the MultiPHP INI editor.

2) The PHP Memory limit can be expanded through the wp-config file.

How to Change PHP Memory Limit in cPanel 3

Steps to increase PHP memory limit through MultiPHP INI Editor

1. Log in

Your website has a cPanel account. You will need to log in to this cPanel account to increase PHP memory limit.

2. Multi PHP INI editor

Once you log in, you will need to conduct a search as Multi PHP INI Editor. When you go to the software section, you will find it there.

3. Basic Mode

There are two types of mode in the Multi PHP INI Editor, they are Editor Mode and Basic Mode. You need to select the Basic Mode.

Now go to ‘Configure PHP INI basic settings’ select the domain root document in order to open the PHP configuration editor.

4. PHP Directives

You will find a record of all the PHP Directives. Understand the maximum limit your website needs; now enter it in the directive –  ‘memory_limit’.

Always remember the memory size needs to be more than post_max_size. And post_max_size must always be more than upload_max_filesize.

Only if you need an increase in limit, you should do so because we have noticed the increase in limit can lead to concerns with regards to security.

Finally, to save all the changes you made, select Apply.

2) Steps to increase PHP Memory limit through the wp-config file

1. Log in to your website through cPanel account

You will need to login into this cPanel account to expand the memory.

2. File Manager

You will need to search for File Manager and select it.

3. Navigate to public_html

Enter the File Manager Folder and click on the public_html option.

4. WP-config file

The wp-config file will be found in the public_html. You can now edit the wp-config file with much ease by simply right-clicking on it.

Once you find the “/”, your work is done. 

Edit no more, Happy Publishing! Add ’/’ above define(‘WP_MEMORY_LIMIT,’’64M’). You can now save the changes by clicking on the icon – Save Changes.

Once you have made the required changes, the latest value will get updated automatically.

A green box will appear once you have made the changes successfully.

This green box will have a message confirming that all the changes have been applied. You can also check our article on How to Redirect a Domain Without Hosting.

That’s all, your all set! I hope you liked reading this article. Now you know to increase the PHP Memory Limit in the cPanel.

Leave a Comment