Web Design & Development, Branding & Marketing Delivering by a leading Birmingham Agency

Share this

What is the PHP memory_limit?

What is the PHP memory_limit?

The PHP memory_limit is the maximum amount of server memory that each PHP script can use.

The official PHP documentation explains this in greater detail.

“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 for PHP memory is 128M. This can be raised if an application or website needs more memory.

When a script exceeds the memory limit that’s been set for the server an error similiar to the following will be logged.

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 update the PHP memory limit for your site through MEDIAMAKS UK or StackCP.