How to enable APC module in PHP

PHP APC (Alternative PHP Cache / Opcode Cache) is framework that optimizes PHP intermediate code and caches data and compiled code from the PHP bytecode compiler in shared memory. APC Opcode Cache is quickly becoming the de-facto standard PHP caching mechanism.

We can install apc in two methods.

Method1- Install APC using PECL in Cpanel Server

Step1: Execute following command from shell as root user

# pecl install apc

and select the options as per the requirement.

Step2: Update global php.ini with the apc extension


Step3: Restart apache service

service httpd restart

Method2- Install APC on Linux server manually using tarball

Step1: Login to the server via ssh

Step2: Install pcre module if not present

# yum install pcre-devel

Step3: Change the location

# cd /usr/local/src

Step4: Download the apc source file from

Step5: Extract the downloaded source archive

Step6: Change the location to the source folder

cd APC-{version no.}

Step7: Run the below commands and complete the installation

# phpize
# ./configure –enable-apc –enable-apc-mmap –with-apxs –with-php-config=/usr/local/bin/php-config
# make
# make install

Step7: Add the extension in php.ini


Step8: Restart Apache

# service httpd restart

Leave a Reply

Your email address will not be published. Required fields are marked *