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.
I hope this will be useful 🙂
I;m on Magento 22.214.171.124 and it’s not working. Thanks
I have a Russian language admin panel, your module changed it to Obra Kadabra how to change the encoding?
version 2.0.0 doesn’t change admin theme themplate files. There is a new injectHtml method to inject the button html.
Your extension works Great in CE 1.8.1.
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 🙂
How about to move additional.phtml somewhere else outside system/cache.
In order to no overwrite core files?
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
Does it only flush local apc cache or cache on all application nodes in case you have more than one?
I get the 404 page after hitting the “Flush APC cache” button?..
Thats a nice read of Magento Cache clear . Thanks
also getting “APC is not installed.” after installing and restarting server
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.
Hi, did you restart apache server?
I have received the following MSG.
“APC is not installed.”
Can you please help me for the same??
i install extension but if click button Flush APC cache have erorr APC is not instaled?
How to config extension?
I´ve a notice that – APC is not installed. I just copied the folder to remote server, i´ve to do something? tks.
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.
In that case, you can solve by disable APC in development time by adding this line to you htaccess file
php_flag apc.cache_by_default Off
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?
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?
Hi Euan, you should disable magento cache for development is better, you don’t need to clear APC cache all of time.
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.