Installing APC for PHP 5.5 and 5.6

If you need to install and enable the php_apc extension for PHP 5.5 or 5.6, there is a way to accomplish this. But before you do this, there are a few things you have to be aware of:

  1. The last PHP version that had the php_apc extension included in was PHP 5.3. * Newer versions of PHP have replaced APC with php_opcache.
  2. The last APC release was php_apc 3.1.14, and while it worked with PHP 5.5, it was immediately removed due to some serious memory issues that could not be fixed. * php_apc 3.1.14 is not available anywhere, it was removed from all official sources.
  3. The only available release of APC is 3.1.13, and while it’s for both PHP 5.3 and 5.4, it’s only non-beta for 5.3 (i.e., not recommended for PHP 5.4).* php_apc 3.1.13 will not work with PHP 5.5+.

Having said that, APC has two parts to it…

  • The opcode cache part that compiles and caches script code.
  • And the data cache part that stores key/value pairs (e.g., just like memcached).

If your scripts require APC, more than likely they only do so because they use APC’s data cache part. And if you want to run those scripts under PHP 5.5 or 5.6, the APCu extension fully replaces APC, and is fully compatible with APC’s API.

APCu is the APC extension with the opcode cache part removed (which was the source of all APC issues) and the data cache part cleaned up. APCu has the same exact functions and configuration directives as APC – so it can be used as a drop-in replacement.

Also, from what I’ve gathered, APCu performs even better than memcache/memcached on single server setups (which is the case 95% of the time if you are using a WAMP such as WampDeveloper Pro).

Installing APCu For PHP 5.5

1. Download the latest build of APCu from –
http://windows.php.net/downloads/pecl/releases/apcu/

For PHP 5.5 Standard:

php_apcu-4.0.7-5.5-ts-vc11-x86.zip

For PHP 5.5 FCGI:

php_apcu-4.0.7-5.5-nts-vc11-x86.zip

2. Extract out files php_apcu.dll and php_apcu.pdb into the proper PHP version package –

For PHP 5.5 Standard:

C:\WampDeveloper\Versions\Php\php-5.5.24.0-r1-win32-vc11-standard\ext\

For PHP 5.5 FCGI:

C:\WampDeveloper\Versions\Php\php-5.5.24.0-r1-win32-vc11-standard-fcgi\ext\

3. Edit php.ini, near end add section:

[APCu]
extension=php_apcu.dll
apc.enabled=1
apc.shm_size=32M
apc.ttl=7200
apc.enable_cli=1
apc.serializer=php

3. Save file. Restart Apache.

20 thoughts on “Installing APC for PHP 5.5 and 5.6”

  1. In case someone wonder – what means the “nts” and “ts” in the file names of downloaded files – “Non-thread-safe” / “Thread-safe” respectively. Small, but important difference. Also “VS11″ means that the library is compiled with MS Visual Studio 11, which again, can be very important, if your PHP installation have been compiled with MS Visual Studio 9 – meaning the extension will not work.

  2. Unfortunately, I’m getting an error.
    “The procedure entry point zend_register_bool_constant could not be located in the dynamic link library c:\…\ext\php_apcu.dll”

    PHP 5.5

    1. As far as I can tell, that function (“zend_register_bool_constant”) is not part of APCu (nor APC). Instead, it is part of the PHP (engine) source code.

      So I’m not sure why it is looking into php_apcu.dll – except that you might have a mismatch between PHP’s branch + build and the APCu binary.

  3. This worked for my WampServer 3.0.4. and APC 4.0.10 with php 5.6.15 and apache 2.4.17. You may also need php PEAR . which is also pretty easy to install.

    Thanks for the additional explanation.

  4. Hi I using IIS on a develop that i dont not why using that on php dev but its that!!
    os i using Symfony 2..8.10 and install apcu to try impulse cache faster..
    so i install all is was fine until try to get a prod enviroment that fails i dont know why for now, the cgi php crash so for now i deactivate until try to fix the problem…

    the cgi crash no mather what i do only on prod env but active or not apc on prod file…

    php ver : 5.6.18
    symfony : 2.8.10

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>