phpwampapc

APC for wampserver 2.4


After 3 hours of searches and differents failed tries, I'm asking help here .. .:(

My configuration:

PHP 5.4.12

Compiler MSVC9

OS: W7 Home premium edition service pack 1

Architecture: x64

Apache: 2.4.4

I've tried many php_apc.dll without success. Is someone found the right one to use or any good alternative to APC?


Solution

  • Installing APC seems fairly simple. I just did it in 10 minutes.

    This assumes you are using a 32bit WAMP even on a 64bit Windows. It seems rather hard to find a precompiled 64bit version of APC so if you are using the 64bit WAMP maybe installing the 32bit WAMP would be a good idea.

    My Environment is WAMPServer 2.4

    The version of PHP I tested this with was 5.3.22 which was running under Apache 2.2.26

    I got the dll's from HERE

    and selected php_apc-3.1.10-5.3-vc9-x86.zip for my PHP5.3 Versions

    and selected php_apc-3.1.10-5.4-vc9-x86.zip for my PHP5.4 Versions

    These are compiled with VC9 (msvc 2008) and match the compiler used to create PHP and APACHE

    Extract the zips somewhere and then copy the php_apc.dll from the ts (thread safe) folder into your php/ext folder

    Edit your php.ini ( using the wampmanager menu links so you get the correct file ) and add this line to the existing section of extension parameters.

    extension=php_apc.dll
    

    While in the php.ini add these parameters for apc at the bottom of the ini file

    [apc]
    ; default memory allocation = 32M
    apc.shm_size = "32M"
    ; for dev check for changed code every time so set to "1". "0" for LIVE site.
    apc.stat = "1"
    

    This is not actually changing anything as these are actually the defaults, but its a useful place holder for when you decide you want to start fiddling with APC's parameters.

    Now to test that the new extension has been loaded, restart apache again using the wampmanager menu, then launch localhost from the menu and click the phpinfo ilnk on the homepage. APC should be the first extension shown in the list of loaded extensions.

    Now create a little script to verify apc is working and place it in the \wamp\www folder

    filename = test_apc.php
    <?php echo '<pre>' . print_r(apc_sma_info(),TRUE) . '</pre>'; ?>
    

    Now run the script from your browser:

    http://localhost/test_apc.php
    

    You should see something like this reported:

    Array
    (
        [num_seg] => 1
        [seg_size] => 33554368
        [avail_mem] => 7396512
        [block_lists] => Array
            (
                [0] => Array
                    (
                        [0] => Array
                            (
                                [size] => 608
                                [offset] => 25985176
                            )
    
                        [1] => Array
                            (
                                [size] => 6696
                                [offset] => 26108536
                            )
    
                        [2] => Array
                            (
                                [size] => 11912
                                [offset] => 26116296
                            )
    
                        [3] => Array
                            (
                                [size] => 552
                                [offset] => 26011544
                            )
    
                    )
    
            )
    
    )