Cuelogic Blog Icon
Cuelogic Career Icon
Home > Blog > All > Installing PHP Accelator APC on Windows

Installing PHP Accelator APC on Windows

Alternative PHP Cache (APC) is a free, open source (PHP license) framework that heavily optimizes and tunes the output of the PHP bytecode compiler and stores the final, compiled result in shared memory. This bytecode optimization leads to faster runtime execution since the low-level instructions become more efficient. Its second, even more important job is maintaining a shared, in-memory bytecode cache which allows your server to re-use the compiled code rather than going through the extremely slow task of retrieving source files from disk and re-compiling them on every page load, thus giving you an even bigger performance boost. Compiled files remain in the shared cache and will only be re-compiled if the original source code files are updated. For a heavy application consisting of a large source code base such as Drupal, you can expect around a 3x increase in page generation speed as a result.
It was once the optimization framework of choice at Facebook and is extremely well suited to accelerating heavy PHP applications thanks to its mature codebase and numerous contributors (including Facebook themselves). It also provides a few extra functions beyond its bytecode optimization and bytecode caching, such as giving your PHP applications the ability to store and retrieve keyed data in a global “data store” housed in shared memory, thereby allowing you to cache and significantly speed up access to very commonly used data without having to constantly go to disk or SQL backends.
Zeev Suraski and Andi Gutmans (the two creators of PHP and the Zend Engine), as well as the other major PHP developers, have decided to officially endorse APC and have scheduled it for inclusion in the PHP core no later than PHP 6. There have been discussions about including it even earlier. While this makes APC the officially endorsed PHP accelerator, they want to be clear that they still support other accelerator projects.

You can find out more useful links about APC here as well as other PHP accelarators

Recently I have upgraded my system to PHP5.4.7 and I had difficulty in setting up the APC, well, I had difficulty in finding the correct binary for the PHP & Apache stack that I had set up. For windows OS you can download proper binary using this link:

Few things to consider before downloading:

  • First confirm whether you need to download thread safe version or non thread safe version This depends on which server you are using, if you are using APACHE server then you can go with thread safe version download, if you are using IIS then non thread safe version is the choice
  • For thread safe version download, you need to identify correct file version before downloading, it depends upon the compiler with which your PHP was compiled. Just open a command shell, go to the php directory and run
    php -r phpinfo();

    You can do the same thing in a script served by the webserver via

    the output contains amongst other things

    PHP Version => 5.4.7
    Build Date => Sep 12 2012 23:44:56 
    Compiler => MSVC9 (Visual C++ 2008) 
    Architecture => x86
    Debug Build => no
    Thread Safety => enabled
    (Based on these values I downloaded apc_3113_beta_php54_vc9_win7-2008.dll )
  • As download finishes, you have the correct pre-compiled .dll of the extension, that matches your system and your version of PHP. Now edit php.inin and add the line extension=downloaded_dll_file_name (e.g. apc_3113_beta_php54_vc9_win7-2008.dll), restart apache, that’s it. Notice the APC block in the phpinfo() result page

PHP Accelerators

APC – Win Web Dev

Alternative PHP Cache (APC) project is free and open. It optimizes PHP code and caches data and code in the shared memory. The project home page is where you can download its source code. 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. You can find the documentation on the page



List of PHP Accelarators


Windows PHP

PHP For Windows:

This site is dedicated to supporting PHP on Microsoft Windows. It also supports ports of PHP extensions or features as well as providing special builds for the various Windows architectures.