How to Change the PHP Memory Limit for Scripts

Like almost everything that runs on computers, PHP scripts require memory (RAM) to operate. Not having access to sufficient memory can cause some scripts to fail, resulting in error messages instead of working web pages.

If you encounter errors such as “Fatal error: Allowed memory size of X bytes exhausted” then you may need to increase your PHP memory limits.

Increasing PHP Memory Limits via SPanel

  • Step 1. Log in to your SPanel dashboard.
  • Step 2. Click on “PHP INI Editor” under the “Tools” section.
  • Step 3. Select the domain you wish to adjust memory limits for.
  • Step 4. Under “memory_limit” change the existing field to the new amount required. The figure should follow a Megabyte increment. For example, to set it to one gigabyte, use 1024M.

How to Change the PHP Memory Limit for Scripts

Understanding PHP Memory Limits

The PHP memory limit is not an overall usage figure. It refers to the amount of memory usable for each visitor session. To illustrate this, let’s take the example of a 128MB PHP memory limit. In this scenario, ten visitors concurrently on your site may result in memory usage of up to 1,280MB.

Setting excessive limits for PHP memory may result in overly high resource consumption, which will ultimately be limited by the amount of memory allocated to your hosting plan.

Was this helpful?

What’s your goal today?

1. Sign up to our newsletter and keep up to date with the latest news. Our team consist of highly skilled ex-sysadmins and hosting veterans, ready to share their unique hosting-related knowledge with you.

Sign up for ScalaHosting monthly News Letter and we will keep you up to date about the most valuable pieces of content we publish on our blog

2. Explore our VPS Hosting - with our 30-day unconditional money-back guarantee and free, effortless migration, you can try our award-winning Managed Cloud VPS solutions risk-free.


Working in the web hosting industry for over 13 years, Rado has inevitably got some insight into the industry. A digital marketer by education, Rado is always putting himself in the client's shoes, trying to see what's best for THEM first. A man of the fine detail, you can often find him spending 10+ minutes wondering over a missing comma or slightly skewed design.

Write a Comment


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.