Home » Php » php – Difference between APC, APCu and Opcache?

php – Difference between APC, APCu and Opcache?

Posted by: admin April 23, 2020 Leave a comment


I am running a web server with the following packages;
php-apc 3.1.7-1
php5-fpm 5.3.10-1ubuntu3.10

However, i have built a new server on Ubuntu 14.04 and seems like php-apc is not available anymore.

Therefore, APC was the lifeserver for my huge traffic (100 k/daily unique visits)

I am little bit confused about caching mechanisms on PHP.
The new server includes these packages:
php-apc 4.0.2-2build1
php5-apcu 4.0.2-2build1
php5-fpm 5.5.9+dfsg-1ubuntu4.7

phpinfo() gives me “apc” as emulated. As far i understand, APC is replaced with APCu.

I am running this free class for my caching, it really saves alot of cpu/mem in my case.
But i can’t understand if this is going to same with APCu?

If its not, how can i setup a proper caching?
Because my new server has limited resources and i need a solution.

php -v returns

PHP 5.5.9-1ubuntu4.7 (cli) (built: Mar 16 2015 20:47:39)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies

Does it means OPcache enabled by default?

How to&Answers:

There is no need for APC (or any of the similar sort of bytecode caching extensions like XCache) as of PHP 5.5 and later. The PHP developers directly integrated what they call OPCache into the core of the product. Not only does this provide greater overall product stability, it is officially supported by the PHP developers.

If you need a specific feature from APC that is not in OPCache (e.g. APCu functionality), then you should start a discussion on the php-dev mailing list.

Finally, a good rule of thumb is to only run versions of PHP that are listed on the php.net homepage. While distros will generally backport security fixes, newer versions of PHP have more useful features. Newer versions of PHP also generally have significant performance benefits that may allow you to bypass needing additional PECL extensions such as APCu.