Enabling PHP opcode caching

Get detailed instructions on how to enable PHP opcode caching with this guide that covers both Alternative PHP Cache (APC) and OPcache.

This article describes how to enable PHP opcode caching.

📘

Note

Although many server accounts already have opcode caching enabled by default, some accounts (for example, Turbo Reseller servers) do not.

About APC and OPcache

The Alternative PHP Cache (APC) and OPcache provide opcode caching. By caching the compiled operation codes (opcodes) of PHP scripts, APC and OPcache enable sites to serve page content significantly faster.

APC is a PHP extension that runs on PHP 5.4 and earlier versions. Because it is a separate extension, it may or may not already be installed on your server. For information about how to determine if APC is installed on your server, please see this article.

OPcache is a drop-in replacement for APC that runs on PHP 5.5 and later versions. OPcache is a core component built into PHP, so it does not require separate installation like APC does.

Enabling opcode caching

To enable opcode caching for your account, follow these steps:

  1. Log in to cPanel.

    📘

    Note

    If you do not know how to log in to your cPanel account, please see this article.

  2. Open the PHP Selector:

    • If you are using the Jupiter theme, on the Tools page, in the Software section, click Select PHP Version:
      cPanel - Select PHP Version icon

    • If you are using the Paper Lantern theme, in the SOFTWARE section of the cPanel home page, click Select PHP Version:
      cPanel - Select PHP Version icon

    🚧

    Important

    If you do not see the Select PHP Version icon, your server does not support this feature.

  3. Select the check box next to the opcode caching extension you want to enable:

    • If you are using PHP version 5.4 or older, select apc.

    • If you are using PHP version 5.5 or newer, select opcache.

  4. Click Save. Opcode caching is now enabled.

More Information

Related Articles