PHP memory limit (memory_limit)

Last modified: Thursday June 19th, 2025

By default, the PHP memory limit (memory_limit) is 128 MB.

If necessary, the memory limit can be increased within the script using the ini_set() function.

Example:
ini_set(“memory_limit”, “256M”);

If the PHP script tries to use more memory than allowed, an error message like the following will appear:
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 2879062 bytes) in /data01/virtXXX/domeenid/www.example.ee/htdocs/test.php on line 5

Was this article helpful?
Views: 100

10 Years Beehosting!
Celebrate with 70% OFF + FREE Site Transfer.

Facebook Instagram linkedin
Menu