Your PHP script will exit and a fatal error will be thrown if it has exhausted all the allocated memory.

PHP Fatal error: Allowed memory size of xxxx bytes exhausted (tried to allocate yyyy) in yourscript.php

This is to protect the system in the case that a rogue PHP script or application consume more memory that the system can handle.

You can fix the issue by allocating more memory to your PHP scripts and there are a few ways to do this.

For cPanel hosting, you can change the memory limit configuration from your cPanel dashboard.

Steps to change memory limit for PHP in cPanel:

  1. Log in to your cPanel account.
  2. Click on Select PHP Version from the Software section.
  3. Click on Options tab at the top of the page.
  4. Find memory_limit option and click on the dropdown icon.
  5. Select the desired memory limit from the list.
  6. Wait for the change to automatically be saved.
Discuss the article:

Comment anonymously. Login not required.