Fatal error: allowed memory size

0.0/10 rating (0 votes)

Fatal error: allowed memory size means that you have reached memory limit that is set in the settings of your web server.

For example, such error text:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 71 bytes) in … means that a limit of 128 MB (number in the text is displayed in bytes) was not enough and it must be increased or memory usage should be reduced.

Solving problems with memory limit

There are two choices how to solve the problem:

  • By optimizing a script.
  • By increasing memory limit.

The first method is a complex one and is not always possible. So we will not describe it here.

Though, very often happens that a website is trying to resize some very large image (for example, a 20MB photo). In this case just use a smaller image.

The second method is more simple and can be used as a temporary solution until you will be able to find the cause of an error. There are several ways to increase memory limit.

php.ini file

This is a recommended method if you have an access to php.ini file. This method doesn’t work on many paid web hostings because they block the access to this file for security reasons. Attention! This method will affect all your websites and scripts located on this server.

Open php.ini file and find memory_limit line:

memory_limit = 256M

Using .htaccess in the website root

Add php_value memory_limit 256M at the beginning of this file. When executing PHP, add the following line before heavy operations:

<?php ini_set('memory_limit', '256M');?>

How to check if the changes have taken place?

Open system information in the Joomla control panel:

System information

Find memory_limit:

memory-limit line

Same can be done using <?php phpinfo();?> command.

If it didn’t work…

In case the solutions from this article didn’t help you (maybe your web hosting doesn’t allow this), ask the support of your web hosting about this problem. If the hosting provider didn’t help you, consider making heavy operations on a local machine. Then transfer the result to the real website.

Alternatively

You can also optimize memory usage by installing APC. It reduces memory usage by 1.5 - 2 times and increases the performance of your website overall. Usually, 64MB is enough for a normal work of Joomla + JBZoo (with a nice reserve for the future).

APC, errors

Still gotta questions, who can help me?

Visit our special JBZoo tech support forum which is specifically meant for JBZoo so the priority of the response and its promptness are much better there than in any other place. With inactive account with a “Plus” sign in a tariff plan you can ask for support in one of these sections or use any of our contacts.