Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 65488 bytes) In Magento 1.9.1

Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 65488 bytes) In Magento 1.9.1

August 14, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 65488 bytes) In Magento 1.9.1

Solving the “Allowed Memory Size Exhausted” Error in Magento

Understanding the Problem

The error message Fatal error: Allowed memory size of X bytes exhausted (tried to allocate Y bytes) is a common issue faced by many Magento administrators when trying to perform certain operations, such as importing products or updating settings. This occurs because the PHP script running the operation requires more memory than what has been allocated.

The Root Cause

In your case, the issue seems to be related to the base URL configuration in the core_config_data table of the database. Changing from {{base_url}} to {{unsecure_base_url}} appears to have caused a conflict that resulted in the error you’re experiencing.

Step-by-Step Solution

1. Increase Memory Limit

The first step is to ensure your server has enough memory allocated for PHP scripts. You can do this by updating the memory_limit directive in your php.ini file or using the .htaccess file as a fallback.

php_value memory_limit 256M

For more advanced memory management techniques, consider using the Opcache extension or reviewing your server’s PHP configuration for optimal performance.

2. Reset the Base URL

Since changing the base URL in the database didn’t resolve the issue, let’s try resetting it to its default value:

UPDATE core_config_data
SET `value` = '{{base_url}}'
WHERE `path` = 'web/unsecure/base_url';

This command will update the unsecure base URL back to the default Magento variable.

3. Flush Cache

After making changes to the database, it’s crucial to flush the cache to ensure that the new settings are applied immediately:

php bin/magento cache:flush

If you’re using a production environment with full page caching enabled (like Varnish or Nginx), make sure to invalidate the cache as well.

4. Re-index and Refresh

Finally, re-index your data and refresh the configuration:

php bin/magento indexer:reindex

Then run the following command to refresh the config:

php bin/magento setup:upgrade
php bin/magento cache:clean

Conclusion

Solving memory limit errors in Magento often involves a combination of increasing PHP’s memory allocation and ensuring your database settings are correct. Remember that each instance is unique, so it’s important to understand the specific context before applying a solution.

For more advanced troubleshooting techniques and performance optimizations for your Magento store, consider exploring our Magento Performance Optimization Guide.

By following these steps and understanding the best practices for Magento configuration management, you can effectively resolve memory limit errors and maintain optimal performance for your e-commerce platform.

Magento 1 Catalog Cache Database

Our network