We use cookies
We use cookies to optimize our website. By continuing to browse the site, you agree to our use of cookies.
New design
Control panel
  • Русский
  • Українська
  • English
  • UAH
  • USD
  • RUB
  • EUR
  • 0-800-307-307 Hotline
  • +38 (044) 392-74-33 Kiev
  • +38 (057) 728-39-00 Kharkiv
  • +38 (056) 794-38-31 Dnipro
  • +38 (032) 229-58-93 Lviv
  • +38 (048) 738-57-70 Odessa
  • +38(093) 170-15-42  Life
  • +38 (067) 400-88-44 Kievstar
  • +1(888)393-24-51  USA, Toll free
  • +44(131)507-01-14  Great Britain
  • +7 (499) 348-28-61 Moscow

2.20.8. Fatal error: Allowed memory size

Error "Fatal error: Allowed memory size"Means that the script exceeded the PHP parameter value during its operation memory_limit current tariff plan.

Fatal error: Allowed memory size of X bytes exhausted (tried to allocate Y bytes) in /home/example/example.com/www/path/to/script.php on line Z
  • X - available memory size, specified by the PHP parameter memory_limit, in bytes.
  • Y - the amount of memory that the script tried to use in excess of the available amount at the time of the error, in bytes.
  • /home/example/example.com/www/path/to/script.php - full path to the script, during the execution of which an error occurred.
  • Z - line number in the script where the error occurred.
Sum of values X + Y is not required value memory_limit, insofar as Y shows the amount of memory that was not enough at the time of the abnormal termination of the script, and in the case of further work, the script may require a much larger amount of memory.

Most often, the error occurs in the following situations:

  • The most common situation in which a script runs out of all available memory is working with images. PNG and JPG formats compress the image, but PHP loads it into memory pixel by pixel to work with it, as if it were saved in BMP format. This results in the script running out of memory to process the image. To avoid an error, you should reduce the size of images before uploading them to the site and do not rely on the fact that PHP itself will change the format of images in high resolution.
  • Executing database queries that return too large amounts of information that do not fit into available memory.
  • Processing large XML files.
  • Launching resource-intensive or just unoptimized scripts and modules.

The solution to the problem might be:

  • Changing the value of memory_limit in PHP settingsif the value is not set to the maximum available at the current tariff.
  • If the site uses scripts of obsolete versions, be sure to check if the set for the site matches PHP version recommended by the site developer. If not, change it to the one you need and check the site in about 10-15 minutes.
  • Reducing the size of the files processed by the script, analyzing the work and optimizing the script itself or the module in order to reduce its memory consumption.
  • Tariff change to another, with a greater value memory_limit.
  • For archive rates with memory_limit 64 or 128 MB - using Turbo Boost can be temporarily (by 2 hours) increased memory_limit up to 256 MB. It is used for short-term exceeding of tariff plan restrictions when uploading goods to online stores, installing various themes and other resource-intensive tasks.

Note for WordPress: if the size of the actually allocated memory (value X) is less than PHP value memory_limit of the used tariff plan, it is necessary to file wp-config.php add line:

define('WP_MEMORY_LIMIT', 'xxxM');

Where xxx - value memory_limit tariff plan.