"Allowed memory size exhausted" in PHP — What It Means and How to Fix It

What the PHP error "Allowed memory size exhausted" means and how to fix it.

Published October 31, 2026

"Allowed memory size exhausted" occurs when a script uses more memory than the memory_limit setting in php.ini allows.

Key points

  • Fix the underlying cause (like loading a huge dataset into memory at once) rather than just raising the limit indefinitely
More PHP articles