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?

Do you want to make your WordPress/WooCommerce site lightning fast?

We guarantee to make your WordPress site load in less than 2 seconds on a managed VPS with ScalaHosting or give your money back. Just fill in the form below and we will get in touch with you.

Please enter a valid name
Please enter a valid website
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Do you want to learn how to grow your website in 2023?

An all-star team of SEO and web influencers are sharing their secret knowledge for the first time in years. You will learn about:

  • What is the future of SEO and how you can be ahead of the curve
  • Web Design best practices and why they matter
  • Secrets to getting the foundation for your website to thrive

An Exclusive Insiders Look Behind The SEO and Web Development Curtain

Rado
Author

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.