PECL APC Cache on CentOS

Posted: 9th April 2014 by admin in all
Tags: , , , , ,

Alternative PHP Cache (APC) is an op-code pre-compiler and a cache system that can boost the performance of a PHP application up to 10 times.

So let's try to install it:


Install Pre-reqs Using yum install the required prerequisites.

sudo yum install php-devel php-pear httpd-devel

Install APC

sudo pecl install apc

Possible errors and troubleshooting during istallation:

  • While running pecl install

    Cannot find autoconf. Please check your autoconf installation 

Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.

Caused: – missed autoconf

Solution:

cd /usr/src
wget http://ftp.gnu.org/gnu/m4/m4-1.4.9.tar.gz
tar -zvxf m4-1.4.9.tar.gz
cd m4-1.4.9/
./configure && make && make install
cd ../
wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.62.tar.gz
tar -zvxf autoconf-2.62.tar.gz
cd autoconf-2.62/
./configure && make && make install
  • While running pecl install

running: phpize sh: phpize: command not found

Caused: – php-devel – Files needed for building PHP extensions – not installed

Solution: Install php-devel from RMP :

php-devel-5.2.17-jason.2.i386.rpm

rpm -Uvh --nodeps php-devel-5.2.17-jason.2.i386.rpm 
warning: php-devel-5.2.17-jason.2.i386.rpm: Header V3 DSA signature: NOKEY, key ID 0d4306ef
Preparing...                ########################################### [100%]
   1:php-devel              ########################################### [100%]
  • After pecl installation apc module doesn't load with PHP
php -m
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/apc.so' - /usr/lib/php/modules/apc.so: undefined symbol: pcre_exec in Unknown on line 0

Caused: Possible that my php version is not fit to apc 3.13 v

Solution: Not found

But..

I removed apc with pecl

pecl remove apc

And reinstalled it from RPM sourse (more older version)

rpm -Uvh php-pecl-apc-3.1.13-3.el5.remi.i386.rpm

php-apc-3.0.19-1.jason.2.i386.rpm

*