install php apc in CentOS

Posted: July 3, 2011 in PHP
Tags: , , ,

Compling with PECL

First, you need install PEAR to get the pecl command.

yum install php-pear

You also need install php-devel to get phpize.

yum install php-devel

Install httpd-devel to get the apxs command.

yum install httpd-devel

Install pcre-devel to prevent the error: ‘apc_regex’ has no member named ‘preg’.

yum install pcre-devel

Install apc.

 pecl install apc

Enable apc in php.ini.

 echo "extension=apc.so" > /etc/php.d/apc.ini

Restart httpd service.

Compiling with phpize

If PECL is not an option, you can also do it by phpize.

First, you need download the apc source from http://pecl.php.net/package/APC. Assuming you have extracted the extention to /path/to/ext/apc.

cd /path/to/ext/apc
phpize
./configure
make
make install

After the installation, apc.so will be put into PHP extension directory.

Following the similar way, you can also install memcache, pdo and other PECL packages.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s