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. Find the right Managed VPS solution

If you’re looking for industry-leading speed, ease of use and reliability Try ScalaHosting with an unconditional money-back guarantee.

2. Make your website lighting 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. Fill out the form, and we’ll be in touch.

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.

3. Streamline your clients’ hosting experience

If you’re a web studio or development agency hosting more than 30 websites, schedule a call with Vlad, our co-founder and CTO, and see how we can deliver unmatched value to both your business and your clients.

Photo

Need a custom cluster or professional advice?

Book a meeting and get a free 30-minute consultation with Vlad, co-founder & CTO of Scala Hosting, who will help you select, design and build the right solution - from a single data center cluster to a multi-region & multi-datacenter high availability cluster with hundreds of servers.

Book a free consultation

4. 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. Learn about the future of SEO, Web Design best practices and the secrets to getting the foundation for your website to thrive. Watch the exclusive webinar.

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.