Clear the APC cache from Magento admin panel

Clear the APC cache from Magento admin panel

Since PHP code is interpreted, every time we run a script, PHP has to parse the script and compile it to opcode (operation code) which represents the function of the code. Zend engine then executes that code.
This process can be really slow because every page load requires reading source files from disk and re-compiling them.
APC (Alternative PHP Cache) is open source PHP extension for caching and optimizing PHP intermediate code.
That means that PHP doesn’t have to parse and compile the code every time you hit the server with new request.
Operation code can be directly executed from the cache, which significantly reduces execution time.
Another advantage of APC is that provides a user cache for storing application data.
For big applications that consist of a large number of source files (e.g. Magento) using opcode caching software such as APC is very important for performance boost.
Recently I created a little Magento extension for clearing APC cache. The idea was to bring together Magento cache management and   I just added a button to the Cache management section in Magento admin panel. That simplifies management of the APC cache.


Cache Management - System - Magento Admin

GitHub Repo

I hope this will be useful 🙂

You made it all the way down here so you must have enjoyed this post! You may also like:

How to save custom data in cache in Magento 2 Lukas Scharmitzer
Lukas Scharmitzer, | 1

How to save custom data in cache in Magento 2

Using Redis cache backend and session storage in Magento Marko Martinovic
Marko Martinovic, | 43

Using Redis cache backend and session storage in Magento

Magento (How to fix): One or more of the Cache Types are invalidated: Blocks HTML output. Tomas Novoselic
, | 83

Magento (How to fix): One or more of the Cache Types are invalidated: Blocks HTML output.


  1. Your extension works Great in CE 1.8.1.

    Many thanks!!!!

    BTW: I did previously mentioned modifications to preserve core functionality.

    Basically I created a block and a layout to “update” additional.phtml with yours.

    It is available if you want to take a look 🙂

  2. How about to move additional.phtml somewhere else outside system/cache.

    In order to no overwrite core files?

  3. After hitting the “Flush APC cache” i get the page with the text :
    “The page you requested was not found”
    I use magento 1.8

  4. Hi,

    Does it only flush local apc cache or cache on all application nodes in case you have more than one?



  5. awesome! I was going nuts when we copied new clients website to our staging as it was redirecting to production all the time. after commenting out block mentioned by robert helped it to access staging and admin and then flushing caches.

  6. Hello
    i install extension but if click button Flush APC cache have erorr APC is not instaled?
    How to config extension?

  7. Works a treat – thanks very much! I’ve bookmarked your post ‘Configuring APC cache’ for later reading.
    Inchoo’s extension is still very handy APC refreshes.

  8. MagentoHostSolution, thanks for the suggestion – I’ve tried to comment out the APC section in local.xml and disabling all Magento caches in Cache Management but still need to refresh the APC cache whenever I make a change – not sure if this is a problem with the APC setup or a Magento setting.
    Any ideas why you think this is?

  9. If APC is just simply installed, it is not so much an issue editing phtml files as APC will recache them when the time stamp changes.
    The big one for having to reset APC is if it is configured in the /app/etc/local.xml with…


    How could this APC management be improved to only clear the APC User Cache of the magento install in question (prefix)?
    If you have several magento installs on one server, all with different prefixes, is seems a waste of resources to simply flush the system cache (think of the non-magento websites you may have installed) and a waste of resources to flush the user cache for everything apart from your prefix.

    Is there a way to only flush the apc user cache with the prefix from the /app/etc/local.xml file?

  10. After installing APC due to slow loading issues, editing Magento’s phtml files was a nightmare because I had to log in to the master cPanel and restart the apache server every time to see the changes – now all I have to do is hit this button in the backend. Brilliant. Works out of the box after a quick disable/enable log out/log in.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <blockquote cite=""> <code> <del datetime=""> <em> <s> <strike> <strong>. You may use following syntax for source code: <pre><code>$current = "Inchoo";</code></pre>.

Tell us about your project

Drop us a line. We'd love to know more about your project.