Installing PHP APC On RHEL/CentOS

  1. Yum up some packages:
    yum install php-pear php-devel httpd-devel
  2. Install APC using pear (the pear installer is smarter than the pecl installer):
    When the installer asks about APXS, say ‘no’. 

    pear install pecl/apc
  3. Tell PHP to load APC:
    echo > /etc/php.d/apc.ini
  4. Restart Apache:
    /sbin/service httpd graceful

13 thoughts on “Installing PHP APC On RHEL/CentOS

  1. Thanks. Very simple, very clear, very complete directions. Are you sure you are a linux guy? They are going to revoke your group membership privileges if you don’t make these directions either partially incomplete or somewhat arcane.

  2. Many thanks. I agree with Mark. After seeing so many ridiculously complicated explanations of the above simple process I can only say again – thank you for you help and effort.

  3. Pingback: Installing APC on CentOS |

  4. @Mike: Because there had to be at least one unexplained, obscure thing in a Linux related post?

    Casey, I’d love to know the answer to Mike’s question as well. Did testing having answered ‘yes’ reveal subtle weirdness? Did things blow up spectacularly? Or does that let you avoid pulling in httpd-devel and all the compiler-related dependencies that that brings in?

    Cheers (and add my thanks to the list!),


    • @Justin:

      My first few tries were with APXS, but they failed (can’t remember errors). It didn’t blow up so bad that I couldn’t try again, it just didn’t work.

  5. I couldnt get this working sadly, APC does not show up on my PHP 5.1.6

    Ive tried adding to my /etc/php.d/apc.ini and when that didnt work to my /etc/php.ini

    Not quite sure whats up but if I figure it out Ill post more.

  6. When I try to Run the below Command it GIves an Error as Follows;
    Suggest me the to FIX this Issue;

    [root@ns1 ~]# pear install pecl/apc
    downloading APC-3.1.6.tgz …
    Starting to download APC-3.1.6.tgz (148,835 bytes)
    ……………………………done: 148,835 bytes
    49 source files, building
    running: phpize
    Configuring for:
    PHP Api Version: 20041225
    Zend Module Api No: 20050922
    Zend Extension Api No: 220051025
    /usr/bin/phpize: /tmp/tmpMLjpYV/APC-3.1.6/build/shtool: /bin/sh: bad interpreter: Permission denied
    Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF
    environment variable is set correctly and then rerun this script.

    ERROR: `phpize’ failed

    How to Resolve this..

Comments are closed.