Install PHP APC on Amazon EC2 Linux AMI or CentOS
Installing PHP APC is usually a two step process as seen in this earlier post using php-pecl-apc, but sometimes we might need to install APC manually. The following steps therefore, outline the procedure for installing APC from the PHP PECL library:
1. Install Linux updates, set time zones, followed by GCC and Make
sudo yum -y update
sudo ln -sf /usr/share/zoneinfo/America/Indianapolis \
/etc/localtime
sudo yum install -y gcc make
2. Install PHP and PHP extension to enable PHPIZE
sudo yum install -y php sudo yum install -y php-devel
3. Install PCRE-DEV
Note: This is an important step, and without installing PCRE-DEV, you will see errors related to “apc_regex” during MAKE such as:
error: ‘apc_regex’ has no member named ‘preg’
error: ‘apc_regex’ has no member named ‘nreg’
sudo yum install -y pcre-devel
4. Install Apache httpd
sudo yum -y install httpd sudo service httpd start
5. Download Latest APC Version
wget http://pecl.php.net/get/APC
In this particular case, it downloaded APC 3.1.10
6. Untar APC, and Compile the Extension
tar -xzf APC
In this particular case, it downloaded APC 3.1.10 so,
cd APC-3.1.10 phpize
7. Configure and Make
./configure --enable-apc --enable-apc-mmap \ --with-apxs --with-php-config=/usr/bin/php-config
make make install
In case you do not know the location of your php-config, run the command below:
whereis php-config
8. Add APC Extension to PHP
sudo touch /etc/php.d/apc.ini sudo echo "extension=apc.so" >> /etc/php.d/apc.ini;
9. Restart Apache
sudo service httpd restart
10. Verify APC Installed and Running
php -i | grep apc
11. Install the APC Monitor
From the root of your APC download and installation folder:
mv apc.php /var/www/html/
This should allow you to monitor APC using:
www.your-domain.com/apc.php
If this tutorial was helpful to you, then please do not forget to leave a comment, or two.


Pingback: Install Apache, PHP, APC and MySQL on Amazon Linux AMI - Coding Steps
Pingback: Php script installation service
Pingback: Install Apache 2.4, PHP 5.4, APC, & MySQL on Amazon EC2 with Amazon Linux AMI - Coding Steps