InMotion Hosting Support Center

After you install APC for PHP to speed up PHP, you'll want to be able to take a look at the APC dashboard, and to clear the APC cache at times.

In this guide I'll cover how you can copy over the apc.php script included with APC to your website so you can see what the cache looks like. I'll also show you how you can either manually clear the cache, or setup a cronjob to automatically clear the APC cache on a consistent basis.

Setup APC dashboard to view cache stats

If you followed along and have already installed APC, you should still have the apc.php file on your server. Using the steps below I'll show you how to copy over this file to your website so you can view the APC cache.

  1. If you're not already, login to your server with SSH.
  2. In this example my cPanel username is userna5. Use this command to copy the apc.php file from your APC source files to your document root:

    cp -frp /usr/local/src/APC-3.1.13/apc.php ~userna5/public_html/

  3. Now you'll want to change the ownership of the apc.php script to your cPanel user with this code:

    chown userna5.userna5 ~userna5/public_html/apc.php

  4. Now visit to access the dashboard. apc dashboard showing cached files and hits

    You can see the number of Cached files and also how many Hits they've had, that is to say how many times APC saved your server from having to load up everything for a PHP script and instead grabbed some content from the APC cache.

Clear APC Cache

To clear the APC cache it's quite simple, just make a script called something like apc_clear.php and then add the following code to it. Make sure to replace with your own local IP address:

if (in_array(@$_SERVER['REMOTE_ADDR'], array('', '::1', '')))
  echo json_encode(array('success' => true));
  die('No valid IP');

When you access this script directly at from your approved IP address, or if you setup a cronjob which will connect with the server's local IP, it will clear out the APC cache for you.

This is an example cronjob setup for clearing the APC cache every 6 hours:

0 */6 * * * /usr/bin/curl --user-agent Cron

You should now understand how to review how effective your APC cache is working for your site, and also how to clear out that cache in the event that pages aren't showing updates because they are still cached.

Support Center Login

Social Media Login

Social Login Joomla

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Ask a Question
n/a Points
2015-10-04 9:21 pm

I'm using file: $VERSION='$Id: apc.php 325483 2012-05-01 00:34:04Z rasmus $';

If you open the apc.php file in a text editor:

  • look in the top of the document for the section just below 'BEGIN OF DEFAULT CONFIG AREA'. 
  • Look for the snippet declaring default values for ADMIN_USERNAME & ADMIN_PASSWORD. 
    • When you change these variables, you set the password on the apc.php file. 
  • Save the file, upload it and navigate to the page with a browser.
  • Click the 'Login' button on the upper right of the page and enter the credentials you just changed.
  • When you successfully log in, a button will appear below the login button location in the upper right that says 'clear opcode cache'
  • Click the button and the cache will clear.

Post a Comment

Email Address:
Phone Number:

Please note: Your name and comment will be displayed, but we will not show your email address.

1 Questions & Comments

Post a comment

Back to first comment | top

Need more Help?


Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail:
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!