CA BD NY
  • Categories

  • Recent Posts

  • RSS MySQL Hacker

  • RSS Apache Hacker

  • RSS MiniCTO

  • Meta

  • Setting Up Alternative PHP Caching (APC) Support on CentOS Server

    Published January 30th, 2009

    Problem Statement

    The APC caching backend is awesome. It speeds up PHP execution by a factor that is worth the trouble of installing it in few minutes. The biggest benefit is that your dumb (or smart) PHP developers do not have to know anything about it. So here is how you can speed up PHP without any help from your superstar PHP programmers.

    Step 1: Make Sure APXS is in your current path

    Since we install Apache on /home/apache, the APXS (apxs) tool gets installed in /home/apache/bin directory which is not typically in our standard BASH path. So we have to add it by exporting the environment variable called PATH as follows:

    # export PATH=$PATH:/home/apache/bin
    

    This appends the /home/apache/bin/ to existing path and thus makes it available to any program looking for apxs.

    Step 2: Install APC via PECL

    The rest of the APC install is as simple as running the following command:

    # pecl install APC
    

    Step 3: Check if APC is bringing in the beacon

    Once APC installs, you need to test if it is functional.

    Get a Trackback link

    4 Comments

    1. Kwasi on August 3, 2009

      I get errors below when using your format to install APC

      Sorry, I was not able to successfully run APXS. Possible reasons:

      1. Perl is not installed;
      2. Apache was not compiled with DSO support (–enable-module=so);
      3. ‘apxs’ is not in your path. Try to use –with-apxs=/path/to/apxs
      The output of /var/tmp/pear-build-root/APC-3.0.19/y follows
      /root/tmp/pear/APC/configure: line 3439: /var/tmp/pear-build-root/APC-3.0.19/y: No such file or directory
      configure: error: Aborting
      ERROR: `/root/tmp/pear/APC/configure –with-apxs=y’ failed

    2. Mario on August 14, 2009

      I have had the same problems of KWASI.

      I solved installing apc from REMI RPM repository with this simple command after updating php

      yum –enablerepo=remi install php-apc

      you can find instructions for updating php here:

      http://bluhaloit.wordpress.com/2008/03/13/installing-php-52x-on-redhat-es5-centos-5-etc/

    3. Mario on August 14, 2009

      sorry, the correct command is

      yum -–enablerepo=remi install php-apc
      (two hyphens)

    4. Coder on December 19, 2009

      this is one of the worst post given for APC.

    Leave a comment

    Comment Policy: First time comments are moderated. Please be patient.