Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Member
    Join Date
    Mar 2006
    Posts
    18

    Exclamation [StepByStep] Decreasing server CPU load with PHP APC cache extension

    As you know, each time php script is executed, PHP interpreter need to compile it first to bytecode and only after that - execute. That compilation takes much time.

    APC PHP extension (which will be included and enabled in PHP6 by default. It becomes a standard) can speedup php script execution process by caching once compiled PHP bytecode in memory. So, installing this extension increases your server performance. To install extension just do the following:

    - cd usr/local
    - mkdir apc
    - cd apc
    - wget http://pecl.php.net/get/APC
    After issuing the last command you will have an archive with latest APC source downloaded to your current directory. At the time of writting this article it is APC-3.0.16.tgz. Let's proceed with unpacking it.
    - tar -zxvf APC-3.0.16.tgz
    - cd APC-3.0.16
    - phpize
    - ./configure
    - make
    - make install
    Now locate your php.ini and open it with your default editor. Add anywhere (at the very end for example) the following line:
    Code:
    extension=apc.so
    - service httpd restart

    Now apc extension should be loaded together with your PHP. To test if it is, just take apc.php file from your installation and put it to the directory accessible by your webserver. Open URL in browser and check how your APC is working for you.

  2. #2
    cPanel Partner NOC cPanel Partner NOC Badge
    Join Date
    Sep 2004
    Location
    Bulgaria
    Posts
    93

    Default

    do you know if it is compatible with Zend Optimizer and eAccelerator?

  3. #3
    Member
    Join Date
    Mar 2006
    Posts
    18

    Default

    APC does basically the same as eAccelerator, so there is no reason to install them both.
    As for Zend Optimizer Google says, it is not yet compatible. I didn't investigate a reason.

  4. #4
    Member isputra's Avatar
    Join Date
    May 2003
    Location
    Mbelitar
    Posts
    593

    Default

    is it compatible with suhosin and zend ?
    It's me ...... It's me ......

  5. #5
    Member
    Join Date
    Mar 2006
    Posts
    18

    Default

    I answered about Zend already. As for Suhosin, there are some compatibility issues. But they can be solved: http://forum.java.sun.com/thread.jspa?threadID=5237815

  6. #6
    Member brianoz's Avatar
    Join Date
    Mar 2004
    Location
    Melbourne, Australia
    Posts
    1,117
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    There are some issues about installing this that you need to be aware of before jumping in and installing this. In particular, I'm concerned that it is incompatible with suPHP (unless I'm missing something!!).

    Of course your server load depends a lot on your customer mix, however my experience is that the average server is not under pressure from high PHP usage so this actually will not help you very much.

    I would not want to install this on a general access cPanel server. Why? For starters, most general use cPanel servers just aren't under that much pressure from PHP. Note - I'm not saying that it never happens that they're under heavy PHP load, just that it's less common. If you install this, you sacrifice the tremendous security benefits of suPHP for a little performance that doesn't benefit you appreciably.

    The point needs to be made that, without suPHP, everyone on the server can see everyone else's PHP files - and in case you don't understand the significance here, that's really, really bad for security. Sure you can run with safe mode, but there are ways around that. (Suhosin may help, I don't have enough experience with it to comment on it.

    If you do have heavy PHP load, it's normally going to be a few heavy hitting accounts, and of course, they could do well by running with APC PHP compile caching. Usually these accounts are well run (ie software is kept updated, etc) and thus security is not as key, so getting rid of suPHP is not such a huge sacrifice.

  7. #7
    Member
    Join Date
    Mar 2006
    Posts
    18

    Default

    You are probably right. APC is compatible with regular WHM/Cpanel installation. It runs without problems on it. I never tested it on patched PHP configurations.

Similar Threads & Tags
Similar threads

  1. fcgid (FastCGI) and APC shared cache
    By larwilliams in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 11-05-2009, 01:21 PM
  2. Load on server decreasing server performance
    By its_joe in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 10-11-2008, 08:13 PM
  3. APC (Alternative PHP Cache) or Xcache works with the phpsuexec ?
    By duranduran in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 04-23-2007, 11:29 PM
  4. Replies: 0
    Last Post: 01-30-2006, 06:34 PM
  5. Server Load (CPU)
    By alnadabi in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 01-23-2006, 02:54 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube