System Status
Buy Now
  • Email & Apps
  • Office 365
Login
  • MyRackspace Portal
  • Cloud Control Panel
  • Rackspace Webmail Login
  • Cloud Office Control Panel
  • Support Home
  • How-To
  • Developer Documentation
  •  Blogs 
    • Expert Insights Tech Blog
    • Rackspace Blog
    • Solve: Thought Leadership

Support Network

End-to-End Multicloud Solutions.   Solving Together.â„¢   Learn more at Rackspace.com

How–To Home

Cloud Servers

  • Introduction
  • FAQ
  • All Articles

PHP memory limit

Last updated on:  2020-10-18

Authored by:  James Andrade


The PHP memory_limit is the maximum amount of server memory that each PHP script is allowed to consume.

Per the PHP documentation:

“This sets the maximum amount of memory in bytes that a script is allowed to allocate. This helps prevent poorly written scripts from eating up all available memory on a server.”

The default value is 128MB. Often, this is raised depending on the amount of memory needed for the web application.

When the PHP script exceeds the limit, you will receive an error similar to the following example:

Fatal error: Allowed memory size of x bytes exhausted (tried to allocate x bytes) in /example/php/script
PHP Fatal error: Out of memory (allocated x) (tried to allocate x bytes) in /example/php/script

You can increase the memory_limit by editing the php.ini file. You should look for a line cthat starts with memory_limit:

memory_limit = 256M

Be aware that the server has a physical memory limit. You should optimize your code if the memory_limit parameter is already set too high.

Share this information:

©2020 Rackspace US, Inc.

Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License

See license specifics and DISCLAIMER

About Rackspace
  • About
  • Customer Stories
  • Events
  • Programs
Blogs
  • The Rackspace Blog
  • Expert Insights Tech Blog
  • Solve: Thought Leadership
  • News
  • Contact Information
  • Legal
  • Careers
Site Information
  • Style Guide for Technical Content
  • Trademarks
  • Privacy Statement
  • Website Terms
Support Network
  • Support Network Home
  • Rackspace How-To
  • API Documentation
  • Developer Center
  • ©2020 Rackspace US, Inc.