APC stands for Alternative PHP Cache, and is a free open-source opcode (operation code) caching plugin for PHP. With APC setup on your server, your PHP script executions can be optimized to run more efficiently, by cutting down on needless dynamic PHP executions.

PHP APC cache example

Why would you want to install APC?

PHP is a dynamic scripting language, so every time there is a request for a page, the server must first parse the code in your PHP script in order to generate the resulting HTML code seen by a visitor's web-browser.

PHP is ideal for web pages that have content that is constantly updated, since each visitor is getting a fresh copy of the page. So for instance if you have your PHP script pulling data from a database, as soon as there is new data in the database, it will automatically be in the generated HTML code for the next visitor requesting that page as well.

However in most cases the constant need to re-run PHP scripts to get back data that might not have even changed in the first place, can be taxing on the server. By implementing APC you can cut down on these repeat PHP script executions, skipping the parsing and compiling steps, as APC stores the resulting opcode, and then that is simply executed each time the original PHP script was requested again.

What's the difference between APC and other types of caching?

APC for PHP is one of the most widely used PHP opcode caching solutions in use today, and APC is planned to be included in the next release of PHP 6 by default as well. You can utilize APC on a VPS (Virtual Private Server) or a dedicated server that is running PHP as either DSO or FastCGI. You might want to read about choosing the best PHP handler for your specific needs, and also a more in-depth explanation on what DSO and FastCGI are.

Another common caching module is Memcached, and the main difference between this and APC is that Memcached is a distributed and more robust generic caching platform, while APC is specifc to PHP. APC is great for when you need local caching of objects for your PHP applications that are relatively small and frequently accessed.

How to install APC

APC is a simple PECL module that can be loaded into PHP, but because it operates at the server-level it can not be run on our shared hosting servers. If you are on a VPS or dedicated server and are comfortable installing PECL modules, then you can go ahead and install APC yourself.

Or if you prefer our system administration department can setup APC on your server for you. If this is something that you'd like to take advantage of please contact our support department.

Did you find this article helpful?

We value your feedback!

Why was this article not helpful? (Check all that apply)
The article is too difficult or too technical to follow.
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
How did you find this article?
Please tell us how we can improve our Support Center:
Email Address
Optional, but our team may contact you for more information.
Like this Article?

Comments

Post a comment
2013-03-23 8:54 pm
I would love some direction on installing APC on an Inmotion VPS. Need to speed up some Magento sites.
2013-09-06 11:44 am
I'm looking for a good hosting with APC pre-installed, do you do that?
Staff
10,559 Points
2013-09-06 12:12 pm
Hello Tpradebe,

Thanks for the question. As per the last paragraph above, we do not support the installation of APC on our shared servers, but you can either install it yourself or have it installed on our VPS/Dedicated server solutions.

There's a simple shell command to install APC on a VPS or Dedicated server (you have to be logged into the shell): pecl install apc. You can find more information here: How to install APC.

I hope this helps to answer your question.

Regards,
Arnel C.

Post a Comment

Name:
Email Address:
Comment:
Are you a bot?
Submit

Please note: Your name and comment will be displayed, but we will not show your email address.

Write New!
Do you want to publish a tutorial to our support center?

News / Announcements

SSL Certficate Warnings
Updated 2014-04-14 11:34 am EST
Hits: 2163
Heartbleed 0-day OpenSSL security bug
Updated 2014-04-14 04:43 pm EST
Hits: 5550

Related Questions

Here are a few questions related to this article that our customers have asked:
Installation of Software on dedicated server
Would you like to ask a question about this page? If so, click the button below!
Ask a Question

Need more Help?

Search

Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail: support@InMotionHosting.com
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!