Magento cache not getting cleared

Magento cache not getting cleared

July 3, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento cache not getting cleared

Magento Cache Clearing: A Comprehensive Guide

Are you facing issues where your Magento store isn’t loading updated configurations even after clearing cache? You’re not alone. This is a common problem that many Magento developers encounter. In this post, we’ll dive deep into why this happens and provide step-by-step solutions to ensure your store loads the latest settings.

Understanding Magento Cache Behavior

Before we troubleshoot the issue, let’s understand how Magento handles caching:

  1. Config Cache: This stores the configuration data read from app/etc/local.xml and other XML files.
  2. Layout Cache: Stores the generated layout instructions for each page.
  3. Block HTML Output Cache: Caches the rendered output of blocks.

When you make changes to your local.xml or any configuration file, Magento should ideally clear the config cache automatically. If it doesn’t, you might still see the old settings.

Common Reasons for Cache Not Clearing

There are several reasons why clearing the /var/cache folder manually might not work:

  1. Incorrect Permissions: Ensure that your web server has write permissions on the var directory and all its subdirectories.
  2. Still Running Processes: If any Magento processes are still running, they may be locking the cache files.

Step-by-Step Solution to Clear Magento Cache

Here’s a comprehensive approach to ensure your Magento cache is cleared completely:

1. Run php bin/magento c:f

This command clears all generated code and config cache.

cd /path/to/your/magento/installation
php bin/magento c:f

2. Check for Running Processes

Use the following command to check if any Magento processes are running:

ps aux | grep php

If you see any processes related to Magento, kill them using kill -9 <process_id>.

3. Clear Cache Manually (if needed)

Even after running the above commands, if cache is not cleared, manually delete or rename the folders inside /var/cache and /var/session.

rm -rf /path/to/your/magento/installation/var/cache/*

You can also just rename these directories to prevent Magento from using them:

mv /path/to/your/magento/installation/var/cache/ cache_old

4. Clear Browser Cache

Make sure you clear your browser cache as well, especially if you’re seeing the issue only in the frontend.

Conclusion: Why This Happens and How to Prevent It

The main reason for this issue is that Magento doesn’t always clear all types of cache when you make configuration changes. Running the c:f command ensures that both config and layout caches are cleared.

To prevent this from happening, follow these best practices:

  1. Always deploy your changes using Git.
  2. Use version control to track changes in local.xml.
  3. Test changes thoroughly before deploying them to a live environment.

Remember, Magento is designed for performance, which means it relies heavily on caching. Clearing cache should be done judiciously and only when necessary.

For more advanced cache management techniques and best practices, consider checking out our comprehensive guide on Magento Performance Optimization.

Happy coding! Let us know if you have any other Magento-related questions.

Cache Security Themes Configuration

Our network