Tag Archives: RedHat

Install APC

How To: Install APC

APC is Alternative PHP Cache. APC is an opcode cache that speed up your PHP applications, by caching both PHP code and user variables. Adding APC to an application improves application response time, reduces server load and make your users happy. This is a free, open, and robust framework for caching and optimizing PHP intermediate code. APC reads your PHP files, parses them into binary format and then caches them in memory so that each request for your PHP files and PHP library files can be served from the parsed cache.

You can see the difference by tracing your code through Xdebug or Zend debugger. You will definately notice a big difference.

Installing APC on RHEL:

First, login as Root User using “su” command.

$pecl install apc

If pecl doesn’t work, install php-devel

$yum install php-devel.i386

if still doesn’t work, if the pecl don’t work then, Please install PEAR first

Then create and add the following to apc.ini

$echo extension=apc.so > /etc/php.d/apc.ini
extension=apc.so
apc.enabled="1"
apc.shm_segments="1"
apc.shm_size="100"
apc.ttl="5"
apc.user_ttl="5"
apc.gc_ttl="5"
apc.file_update_protection="2"
apc.enable_cli="1"
apc.max_file_size="1M"
apc.write-lock="1"
apc.report_autofilter="0"
apc.include_once_override="0"

Restart the Apache webserver:

$service httpd restart

Installing APC on Ubuntu:

$sudo apt-get install php-apc
$sudo /etc/init.d/apache2 restart

That’s it!!! You are done, APC is installed on your web server.