PHP and WAMP logos

Installing APC for PHP in WAMP

Trying to crank out a bit more performance from WAMP? One simple way is to cache PHP. The most popular PHP caching plugin is APC (Alternative PHP Cache). The web is littered with posts on how to properly install APC on a Linux server, but I had a bit more trouble installing it properly on WAMP. Before we get started, you should note that APC is only available for PHP 5.3 and 5.4 versions. PHP 5.5 has its own caching mechanism, and APC is therefore not needed. Alright, with that in mind, let’s do this.

  1. Download APC built for Windows for the version of PHP that you are running.

    If you Google “Download APC for Windows” you’ll likely end up on the download site. In those builds debugging was left on and I could not figure out how to turn it of without rebuilding APC. The folks at Win Web Dev (referenced in the first link) have been kind enough to provide several builds of APC for multiple versions of PHP.

  2. Copy the php_apc.dll file from your download in step 1 to the extensions directory in the PHP folder of your WAMP directory, [path-to-wamp]/bin/php/php.#.#.#/ext where [path-to-wamp] is the location that WAMP is installed on your machine and #.#.# corresponds to the version of PHP that you are running.

    Screenshot of php_apc.dll file being copied and pasted
    Copy php_apc.dll To Your PHP Directory
  3. Copy the apc.php file form your download in step 1 to the www directory in WAMP. The apc.php file includes monitoring and performance statics along with your APC configuration settings. It’s quite helpful when testing out different configurations of APC.

    Screenshot of apc.php being copied and pasted
    Copy apc.php To Your PHP Directory
  4. Completely exit and restart WAMP.

  5. Enable the php_apc extension in WAMP. After enabling the APC extension, WAMP will automatically restart all services.

    Screenshot of php_apc in the PHP Extensions menu of WAMP
    Enable APC PHP Extension
  6. Open up your php.ini file from the WAMP menu, scroll to the bottom of the file and setup your APC configuration. Below is a screenshot of my APC configuration in WAMP.

    Optimal configuration of APC depends on your server setup as well as the application(s) you are running. While this is outside the scope of this post, there are plenty of articles on the web for you to learn more about optimizing your APC configuration. You should start by learning APC’s functions.

    Screenshot of php.ini file in WAMP menu
    WAMP php.ini File

    Screenshot of my APC configuration in the php.ini file of WAMP
    WAMP APC Configuration
  7. Lastly, save your php.ini file and select the option to Restart All Services in WAMP. Give yourself a pat on the back, you have successfully installed APC for PHP on WAMP. Make sure to frequently check your apc.php monitoring page from step 3 at [path-to-wamp]/www/apc.php while you nail down your APC configuration.

    Screenshot of the WAMP menu option to restart all services
    Restart All Services

5 thoughts on “Installing APC for PHP in WAMP”

  1. Hi Ahamed,

    I’ve updated the post with a link to the folks at Win Web Dev. Per their site, “Binaries that you can download from this site are built from official releases of APC and PHP. The only added thing is the version info sheet for dlls.”

    Good luck with the install!

Leave a Reply

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