1. Home
  2. cPanel
  3. How to change PHP Memory limit setting in cPanel with CageFS and CloudLinux

How to change PHP Memory limit setting in cPanel with CageFS and CloudLinux

RedyHost cPanel hosting plans come with CloudLinux and GageFS, thus to update PHP Memory limits in PHP should be managed via the cPanel.

Change PHP memory limit in universal way

To change memory limit globally (in our example we increasing it to 256MB), to be applied via the CLI and the web server.

In your configuration file (e.g. settings.php, configuration.php or wp-config.php add the following to the bottom of the file and save/upload to the server

ini_set("memory_limit", "256M");

 

cPanel, Apache

To update PHP Memory limit for Apache, follow these steps:

1. Login to cPanel and click

2. Click Switch to PHP Options link

3. Select new PHP Memory limit and click Apply button, then Save button.

Your PHP memory limit applies immediately.

Drush

To update the memory limit for drush, create or edit the following file in your home directory:

~/.drush/drush.ini

Add or change the line at the bottom of the file

memory_limit = -1

Save the file, your new limit is applied fro Drush/CLI immediately.

Nginx

If you account is setup to replace Apache web server with Nginx (Nginx with PHP backend), then you need to follow the below instructions in order to update your website’s PHP memory_limit setting.

Create or edit the file named .user.ini inside your web root (normally ~/public_html) and add the following to it:

ini_set("memory_limit", "256M");

Update the required memory limit in the example above to suit your requirements. Keep in mind that 256MB is quite high value. If you need to increase it conditionally, for example based on URI, use the Universal Way method at the top of this page.

Updated on 7 June, 2017

Was this article helpful?

Related Articles