Installing APC on AWS Linux AMI

Update: Current versions of Amazon’s Linux AMI include the package php-pecl-apc (v3.1.9 – the same as the latest from PECL) in the repository. Using a package manager is usually preferable to using PECL- it will help you keep up to date, is centrally managed, and minimizes unnecessary dependencies (especially build tools). APC can be installed from yum via:

yum install php-pecl-apc

Definitely drove me crazy for a bit – installing APC through PECL fails, and it won’t install through yum either (for me, this was true trying to use the apc-beta, and with compiling from source). To install, first install pcre-devel, gcc, and make.

sudo yum install pcre-devel
sudo pecl install apc-beta 

If everything works out, enable APC by adding it to the PHP configuration:

echo "extension=apc.so" | sudo tee /etc/php.d/apc.ini

Finally, restart apache (or other server):

sudo service httpd restart

By cyberx86

Just a random guy who dabbles with assorted technologies yet works in a completely unrelated field.

2 comments

    1. Thanks for pointing that out – PECL installations compile code so those dependencies are not unexpected. This is actually quite an old post, and current versions of Amazon’s Linux AMI include the package php-pecl-apc (v3.1.9 as of today) in the repository. I’d favour installation via yum over PECL whenever possible.

Leave a comment

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