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 extension=apc.so > /etc/php.d/apc.ini
  4. Restart Apache:
    /sbin/service httpd graceful

13 Responses to “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. @Mark:

    Thanks, but don’t worry for me. These directions will become incomplete and misleading as soon as the underlying OS changes.

  3. 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.

  4. Hi Casey,
    Can you explain why you choose “no” for APXS?

    Thanks,
    -mike

  5. Very clear.
    Good job.

  6. @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

    • @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.

  7. I had to add the line below to my php.ini to get APC to load on RHEL with PHP 5.2.

    apc.rfc1867 = 1

  8. The first command should be

    yum install php-pear php-devel httpd-devel pcre-devel

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

    Ive tried adding enable=apc.so 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.

  10. 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..

Trackbacks

User contributed tags for this post:

yum apc (520) - apc centos (317) - pear install apc (288) - centos php apc (275) - centos apc (272) - install APC centos (261) - php apc rpm (258) - yum install apc (236) - php apc centos (193) - centos install apc (187) - php apc install (160) - apc rpm (146) - install php apc (135) - yum install php-apc (128) - pecl install apc (114) - php-apc rpm (100) - redhat install apc (96) - yum install php apc (92) - rhel apc (84) - centos apc install (84) - php-apc centos (81) - centos install php apc (81) - apc php centos (78) - apc yum (77) - rhel pecl (67) - apxs centos (67) - apc apxs (60) - install apxs centos (57) - apc install (53) - install php apc centos (53) - php apc rhel (52) - installing apc centos (51) - rhel php apc (51) - install apc php (50) - APC install centos (49) - install apc (49) - PECL rhel (42) - install apc rhel (42) - install apc redhat (39) - yum install json (38) - APC RHEL (38) - centos php apc install (37) - php pear install apc (37) - yum install php json (36) - php apc (35) - installing apc on CENTOS (34) - centos apxs (33) - install apc with pear (33) - install apc on centos (33) - how to install apc on centos (32) - centos 6 APC (32) - yum install apxs (31) - install apc php centos (31) - centos php json (30) - install apc pear (30) - yum json (29) - rhel install APC (29) - centos php-apc (29) - yum php json (28) - how to install php apc (27) - redhat php apc (27) - centos install apxs (26) - centos 6 php apc (26) - install php-apc (25) - php apc install centos (25) - yum install php-json (24) - No package httpd-devel available. (24) - install apc centos 5 (23) - apc redhat (23) - rpm php apc (22) - yum install pecl (21) - php apc redhat (21) - pecl install apc apxs (20) - php json centos (19) - RHEL apxs (19) - apxs centos 5 (19) - install apc centos 6 (19) - yum php-apc (18) - centos apc yum (18) - centos yum apc (18) - php apc centos 6 (18) - apc centos 6 (18) - pecl APC RPM (17) - pecl install apc centos (17) - php-apc redhat (17) - yum install php-pecl-apc (17) - enable modul php53-apc.ini centos (17) - php APC yum (16) - yum php-json (15) - installing pear on centos (15) - yum apc php (15) - apc rpm centos (15) - centos apc rpm (15) - apc php rpm (15) - rpm apc (15) - yum php apc (15) - centos 6 install apc (15) - centos 5 php json (14) - json centos (14) - pear centos (14) - install apc using pear (14) - php-pecl-apc rpm (14) - pear apc (14) - install php apc on centos (14) - centos php-json (13) - json php centos (13) - rhel apc php (13) - APC PHP RHEL (13) - centos apc.php (13) - apxs rhel (13) - php-json centos (12) - yum install json php (12) - yum apc centos (12) - php apc apxs (12) - centos php (12) - yum apxs (12) - yum install apc php (12) - centos 6 pecl (12) - centus 6 install apc (12) - php json rpm (11) - centos json (11) - PHP json yum (11) - install JSON centos 5 (11) - install json centos (11) - pecl apc centos (11) - centos install pear (11) - installing APC rhel (11) - red hat php apc (11) - install apc on centos 6 (11) - apc php yum (10) - json yum (10) - php-apc (10) - installing apc in centos (10) - pecl apc apxs (10) - how to install apc in centos (10) - install pecl apc (10) - apc pear (10) - pear apc install (10) - apc pear install (10) - php apc pear install (9) - php json centos 5 (9) - rhel json (9) - php-json rpm (9) - json centos 5 (9) - php-json centos 5 (9) - install json php 5.1.6 (9) - php json rhel5 (9) - APC rhel5 (9) - yum install APC CentOS (9) - php apc rhel5 (9) -