Need help?

Our experts will login to your server within 30 minutes to fix urgent issues.

We will keep your servers stable, secure and fast at all times for one fixed price per month.

APC Caching at your Service!

The APC caching is quickly becoming a Standard caching mechanism.

It improves the script executions in the server by cutting down on dynamic PHP executions.

Here, at Bobcares, we often receive requests regarding the caching errors as a part of our Server Management Services.

Today, let’s discuss about installing APC cache and see how our Support Engineers fix the errors.


More about APC caching

Before we get into the installation part, let’s know more about the APC caching.

APC is abbreviated as Alternative PHP Cache. It provides a free, open, and robust framework for caching and optimizing PHP intermediate code.

To improve the performance, APC stores this bytecode so that it can be reused instead of having to be recompiled each time.

APC is a PECL module that is loaded into PHP. As it operates at the server-level it can not be run on shared hosting servers.

So, this is limited to only VPS or dedicated servers which is comfortable installing PECL modules.


Installing APC caching

Now, let’s see how our Support Engineers install this APC cache on CentOS.

Initially, we install the required packages. And they are pecl, phpize and apxs commands to install APC using YUM package.

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

After running the above command, now we have the needed packages to install APC. So, we use the PECL command to install APC.

pecl install apc

Then, we enable the APC PHP extension using the command

echo "" > /etc/php.d/apc.ini

After that, we restart the Apache for the new changes to occur.

service httpd restart


Verifying the APC installation

After installing the APC, let’s now verify the installation.

We create a phpinfo.php file in the webroot and then add the below code within it




Then, access the file using the domain name. For instance, http://domain_name/phpinfo.php


Common errors with APC caching

Let’s now see some common errors relating to APC caching. And see how our Support Engineers fix it.


1. Internal Server Error

Recently, one of our customers approached us with some problems with APC working properly. File cache always shows Hits = 1 and misses kept on increasing.

He was always receiving an internal server error.

Our Support Engineers started investigating the problem and found that the customer had a Zend Opcache enabled on the server before migrating the website to APC cache.

This was conflicting and the website was throwing an error.

So, we removed the Zend Opcache.

Also, we edited the apc.include_once_override value from 1 to 0.


2. Fatal error

We received another request from our customer with another error message.

The error message was as below

Fatal error: require(): Cannot redeclare class zend_db_adapter_abstract in /paths/app/lib/Zend/Db/Select.php on line 27

We finally, fixed this error by adding the below code in the configuration file.

apc.include_once_override = 0
apc.canonicalize = 0
apc.stat = 0


[Need any assistance with APC caching? – We’ll help you]



Today, we went through the installation of APC Caching and saw how our Support Engineers fix its related errors.


Submit a Comment

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