Skip to content

Using APC or OPcache with Magento

Magento is a resource‑intensive ecommerce platform, and enabling opcode caching is one of the most effective ways to improve performance. Both APC and OPcache store precompiled PHP code in memory, reducing the need for repeated compilation and speeding up page delivery.

    • If running PHP ≤ 5.4, APC may be available.
    • If running PHP ≥ 5.5, OPcache is recommended.
    • Use phpinfo() or cPanel’s PHP Info to confirm APC/OPcache status.
    • Look for sections labeled APC or Zend OPcache.
    • APC and OPcache operate at the web server level.
    • Magento automatically benefits from performance improvements once caching is enabled.
    • Adjust settings in php.ini for optimal performance:

      opcache.enable=1
      opcache.memory_consumption=256
      opcache.interned_strings_buffer=12
      opcache.max_accelerated_files=65406
      opcache.revalidate_freq=2
    • These values can be customized depending on server resources.

  • APC is deprecated; use OPcache if possible.
  • Always clear Magento’s cache after enabling or changing opcode caching.
  • For more details, see the official PHP OPcache documentation.