Knowledgebase

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.


Also Read: How To Decrease Inode Usage In cPanel?


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


Also Read: How to Access the cPanel Database Remotely?


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.


Also Read: How to Change PHP Version in cPanel?


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.