How to Increase the PHP Memory Limit in cPanel?

The PHP memory limit is a configuration setting determining the maximum amount of memory a PHP script can consume. This limit prevents individual scripts from using excessive server resources, which can lead to slow performance for other users or even cause the server to crash.

This is why managing the PHP memory limit is one of the most important aspects of website administration, particularly when dealing with resource-intensive applications or in environments where multiple applications or plugins are in use, such as WordPress, Joomla, or Drupal.

In this article, we will provide a detailed walkthrough on increasing the PHP memory limit in cPanel and cover each step comprehensively to ensure you can confidently adjust this setting according to your website’s needs.


 


Steps to Increase the PHP Memory Limit in cPanel

➔ Log in to cPanel.

Log in to cPanel

➔ Once logged into cPanel, you need to scroll down or use the search feature to find the ‘Software’ section.

search feature to find the Software section

➔ Within the ‘Software’ section, you have to look for the ‘MultiPHP INI Editor.’ 

look for the ‘MultiPHP INI Editor

➔ In MultiPHP Ini Editor, there are two modes: Basic mode and Editor Mode. From those options, you have to click on ‘Basic mode.’

click on Basic mode

➔ In the ‘Configure PHP INI basic settings’ section, select the location of the domain’s root document to open the PHP configuration.

select the location of the domain’s root document

➔ Once you choose the directory, you will be presented with a list of directives.

list of directives

➔ You have to locate the ‘memory_limit’ directive.

locate the ‘memory_limit’ directive

➔ It might be set to a default value like ‘128M’ (128 megabytes). Depending on your needs, you have to change this value to a higher limit, such as ‘256M’ or ‘512M.’ 

value to a higher limit

Note: You should be cautious about setting the memory limit too high, as this could affect the overall server performance, especially in shared hosting environments.

➔ After you have entered the new value, click the ‘Apply’ button at the bottom of the page to make your changes effective.

click the ‘Apply’ button


 


Verify the Changes

It’s time to verify whether the changes have been applied or not. 

➔ To ensure that, you need to create a simple PHP file called info.php with the following content:

     <?php phpinfo(); ?>

➔ Upload this file to your website and access it via a browser (e.g., http://yourdomainname.com/info.php).

➔ You need to look for the ‘memory_limit’ entry on the page to confirm that the new setting is active.


 


Conclusion

As you have checked, adjusting the PHP memory limit via cPanel is straightforward and can resolve many performance-related issues in PHP applications. However, you must always monitor your website’s performance following changes to ensure optimal operation. 

Byla tato odpověď nápomocná?

Související články

What is Email Routing in cPanel & How to Do it?

Introduction If you have ever hosted a website and set up custom email addresses using cPanel...

How to Install WordPress in cPanel?

Are you looking to start your website or blog? WordPress is one of the easiest and most powerful...

How to Change the PHP Time Zone Using php.ini?

Imagine you are running a global website that caters to users from New York to Tokyo. A user...

Best Ways to Secure cPanel From Hacking

If you have a cPanel to manage things, in that case, your cPanel is like the control room of your...

A Simple Tuide to Connect Your cPanel Email to Gmail

Introduction cPanel, as the name suggests, is a GUI-based control panel with your web hosting...