Enabling APC on a bluehost shared server

This guide will help you set up PHP APC on a Bluehost shared server, it works as of June 19, 2014 but bluehost could break it at anytime.

Making APC

Log into your account with SSH and execute the following commands

cd ~
mkdir modules apc
cd apc
wget http://pecl.php.net/get/APC-3.1.13.tgz
tar -xzvf APC-3.1.13.tgz
cd APC-3.1.13
/usr/php/54/usr/bin/phpize
./configure --enable-apc --enable-apc-mmap --with-apxs --with-php-config=/usr/php/54/usr/bin/php-config
make
cd modules
mv apc.so /home/BLUEHOST-USERNAME/modules

Activating and Configuring APC

Log into the CPanel and go to PHP Config
Change the php.ini file to PHP 5.4 (FastCGI) and click save
Now you’ll have to edit the php.ini file, it will be located in the /public_html directory
find and comment out the extension_dir line
below it put extension_dir = "/home/BLUEHOST-USERNAME/modules"
find the “Window Extension” section and paste in the following values.
extension=apc.so
apc.enabled=1
apc.ttl="7200"
apc.user_ttl="7200"
apc.shm_size="64"

Upload the file back to your site and APC should be enabled

Making sure it’s installed

If you want you can check the installation by making a phpInfo file.


<?php

// Show all information, defaults to INFO_ALL
phpinfo();

?>
and uploading it to your server, then loading that file in your browser. APC should be listed on the page.

Leave a Reply

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