46 Comments

  1. brad

    I don’t have /etc/php.d/apc.ini and nano won’t let me create it. what should i do?

    Reply

    1. The only reasons I can think that nano won’t let you create it is because either 1) you’re in a shared hosting environment, or 2) you’re not the superuser (root) when you try to create apc.ini. If shared hosting, which one are you using? If it’s the root issue, just su root and give it a shot.

      Reply
      1. brad

        VPS logged in as root. i don’t have a php.d directory.
        does that mean that php-devel didn’t install?

        Reply

        1. If you have a php.ini file (generally in your web root directory in a shared hosting or VPS environment), you can also add the configuration options in there. I’ve updated the blog post to mention that.

          Reply

  2. Steve, nice tutorial. I have reimaged my server 4 times trying to get this right. Running centos 5.5 with plesk. I got down to the .config/ line and got this:
    php-config: /usr/bin/php-config /usr/share/man/man1/php-config.1.gz
    [root@u15729373 APC-3.1.9]# ./configure –enable-apc –enable-apc-mmap –with-apxs –with-php-config=/usr/bin/php-config
    checking for egrep… grep -E
    checking for a sed that does not truncate output… /bin/sed
    checking for gcc… no
    checking for cc… no
    checking for cc… no
    checking for cl… no
    configure: error: no acceptable C compiler found in $PATH
    See `config.log’ for more details.
    [root@u15729373 APC-3.1.9]#

    Also I have no make? Can you tell me how to install “make” ?

    Thanks, TD

    Reply

    1. Ahh…. it looks like you don’t have a C compiler. I recommend gcc. Do this to install it:

      yum groupinstall “Development Tools”

      Be sure to include the quotes. That should install everything you’re missing! I’ll add this step to the article.

      Reply

  3. Excellent article! I followed every step here and finished it with no problems! :)

    I just have one question, i moved that apc.php to our ‘main’ domain so i have only one entry place for apc statistics, so the question is: do i need to copy apc.php to every domain in order or is only one copy of apc.php enough to see statistics across entire server?

    Thanks.

    Reply

  4. Hmm ok i just added apc.php to another domain which has much
    more traffic and I’m seeing different stats. So i guess this does need to be added per domain?

    Sorry for maybe dumb question. :)

    Reply

    1. That’s interesting. As I understand it, you’ll see stats per cache, so you should see the entire server’s stats in one spot. Maybe stuff is just expiring quickly? Try loading both apc.php files side-by-side and see if there are major diffs.

      Reply

  5. Well take a look your self:

    (removed for security)

    Both domains are on same server.

    I’ll leave these files on with no authentication for next 10-12h or until your next comment. Second site has barely any traffic atm.

    Reply

    1. Well, yep! Looks like two separate 64M caches. Do your vhosts all share a single php.ini file? You may want to do some Googling about optimizing APC with virtual hosts. You may be able to get away with a smaller cache on your “quieter” site.

      Reply

  6. Hmm well then that means i have 64M for every domain i have on server(11 at the moment)?

    I disabled APC at the moment and i will google regarding this issue and also i will contact my hosting support to see if they can help me with this.

    Reply
  7. Mathiau

    well

    found this

    yum install pcre-devel

    and it now looks like it worked, not a single guide mentioned pcre-devel :)

    Reply
  8. roberto

    I tried to install apc but i got this

    ./configure is not a file o directory

    any help?

    Reply
      1. roberto

        im into /usr/bin/
        and then run ./configure and get the message

        Reply

        1. Ah… please carefully re-read the part right after “Now it’s time to set it up!” You don’t ever need to be in the /usr/bin directory, you simply need to reference that directory in the ./configure statement. Follow the instructions exactly as written, and you should be fine. :)

          Reply
          1. roberto

            i repeated the steps and got this

            root@server1 [/usr/local/src]# phpize
            Cannot find config.m4.
            Make sure that you run ‘/usr/local/bin/phpize’ in the top level source directory of the module

          2. roberto

            I have centos 5.7 i dont know if this helps you. I tried for days. PHPINFO says its enabled but when i try to use apc.php top see teh report I got
            Internal Server Error

            The server encountered an internal error or misconfiguration and was unable to complete your request.

            Please contact the server administrator, webmaster@tiendaporcelana.es and inform them of the time the error occurred, and anything you might have done that may have caused the error.

            More information about this error may be available in the server error log.

            Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

  9. roberto

    Finally its installed, and I can see the graphic open apc.php but I think its not woring because the only file is cached is apc.php no other file is cached

    Reply

  10. Jack

    Hi, I got apc.so in modules and added the apc.ini in php.d folder but didn’t work with my apache server, do you know why?
    Thank you!

    Reply
    1. jack

      it works, apache load the apc.so in different folder.

      Reply

  11. Sometimes, once in a while I stumble upon blogs like this…first I read this post (of course my problem was solved after reading this) but I wanted to know more about you… coz somewhere I already knew that u have to be someone different from others… so I read ur bio n my guess was right… u r the man….keep it up Steve..am only 25 yrs at present I might never get chance to meet u but I will always pray for you and your family…am subscribing to your blog…love…

    Reply

  12. hello friend,
    i’m here by looking for how we install apc on linux.
    as im a newbie for linux administration, sometime i will meet an error or crash my site. I hope you can include tutorial how i gonna totally uninstall APC in case after installation my site not working well.
    thank you.

    Reply

  13. @garaa what problem u facing few days ago I successfully installed APC on linux centos 5.7

    Reply

  14. Hi thank you for your great steps in how to install APC, I get to point phpize command no issue, but when I type in phpize in the terminal I get command not found, so I don’t get the ability to continue, what could be wrong, I am on Plesk 10, and php 5.3.3.
    Please help me, I am stuck badly
    Thanks
    ART

    Reply

  15. Dear Steve,
    thanks a lot for the HowTo. At the moment I can not really guess the efficiency of APC, but installation instruction works great!
    Thank you!
    Best regards
    Martin

    Reply
  16. bill

    Thanks Steve, It is a rarity that instructions work as advertised but your did with no problems.

    Thanks again

    Reply
  17. Sergey

    apc.php is not located anywhere on my Debian 6.04 after APC installation. Any idea where to get it?

    Reply

  18. Hi Steve,
    I followed the steps and done evrything in it. Everything went right but now when I added the phpinfo file, there is no section about apc.

    Any idea ?

    Thank you

    Reply
  19. Andy

    Don’t work

    All I get in my log is….

    PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/local/lib/php/extensions/no-debug-non-zts-20060613/apc.so’ – /usr/local/lib/php/extensions/no-debug-non-zts-20060613/apc.so: cannot open shared object file: No such file or directory in Unknown on line 0

    Reply

    1. Thanks – glad you got it working! Although, I’m hoping that the “many failed attempts” were while trying some other documentation, instead of this one! :)

      Reply

  20. Worked like a charm minus the httpd restart (/etc/init.d/httpd restart graceful) in my case!

    Uzi

    Reply


  21. Every time I enable this it crashes my site with a no response error.

    APC Support disabled
    Version 3.1.9
    APC Debugging Disabled
    MMAP Support Enabled
    MMAP File Mask no value
    Locking type pthread mutex Locks
    Serialization Support broken
    Revision $Revision: 308812 $
    Build Date Mar 25 2013 11:59:36

    Reply

  22. When I check my /var/log/httpd/error_log :

    PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/lib/php-zts/modules/apc.so’ – /usr/lib/php-zts/modules/apc.so: undefined symbol: sapi_globals in Unknown on line 0

    Reply

Leave a Reply