PHP 5.5 includes zend opcache by default, which basically means that almost nobody will use APC.
But what to use instead of the user data cache part of APC (apc_store & apc_fetch & similar)?
I can imagine using redis or memcache to store the hashes of static files, but it seems silly to ask another process over network or socket just to get a hash of file content. APC user data cache (which is in shared memory and accessing it is almost as fast as accesing php variable) seems just the right thing to use for such data.
So the question is: what to use in php 5.5 to cache small bits of data instead of APC?
Starting from PHP 5.5 the APC user data storage is packaged separately as PECL APCu.
- Source code: http://pecl.php.net/package/APCu
- MacOS homebrew package is php55-apcu (
brew install php55-apcu)
- Debian/ubuntu is called php5-apcu (
apt-get install php5-apcu)
- Fedora/RedHat is called php-pecl-apcu (
yum install php-pecl-apcu)
- Windows – use precompiled APCu dll – follow instructions provided in the answer below.
This allows you to use all user cache functions, such as apc_store(). It will also return
extension_loaded('apc') – this means that all libraries depending on APC will work similarly to PHP 5.4.
I recently dealt with this question after upgrading from php 5.3 to php 5.5 beta 2.
I looked at Memcache and Redis. Depending upon whom you ask, the performance between the two is approximately the same. Some claim that Redis is marginally faster. However, Redis has a lot more features than Memcahe so I decided to go with Redis.
For a PHP client, I chose Phpredis over Predis. Phpredis is a C extension whereas Predis a pure PHP implementation. Thus, Phpredis is generally faster.
I’m primarily using Redis to cache and retrieve serialized objects. I started the project I’m currently developing in PHP 5.3 with APC. I’m continuing to develop the project with php 5.5 and Redis. While I don’t have benchmark statistics, I can tell you that the app “feels” faster. This is likely due to performance enhancements in php 5.5 as opposed to APC user cache verses Redis. Either way, I’m happy with my choice.
I hope that helps. Good luck and happy hacking 🙂
Nothing more to say. You got the correct answer already. I guesy I can provide you with a link to tutorial to how to download and install APCu on XAMPP on Windows for php 5.5 and 5.6:
Link do download APCu for php build from 5.3 and higher:
download APCu different versions
Installation tutorial: instalatioiin instrucions (The newest version should be on the very bottom of the file list – use this one)
Also bear in mind that you will have two to choose from few options like 64 or 84 version as well as nts or ts and vc9 or vc11 (it can be different in your case) and ofcourse the corect php version (in my case that would be PHP 5.6 for my xampp).
if you want to pick right you have to run phpinfo() first and check for those parameters:
Zend Extension Build and Architecture
In my case that would be:
[Zend Extension Build:] API220131226,TS,VC11 [Architecture:] x86
That mean that in my case I would have to choose ACLu wchich contain
in file name those parameters 5.6, TS, VC11, 86
file name to download: php_apcu-4.0.7-5.6-ts-vc11-x86.zip
Hope that clear things up for you.
Some aditional explanations on different PHP builds:
difference ts vs nts:
TS refers to multithread capable builds. NTS refers to single thread only builds. Use case for TS binaries involves interaction with a multithreaded SAPI and PHP loaded as a module into a web server. For NTS binaries the widespread use case is interaction with a web server through the FastCGI protocol, utilizing no multithreading (but also for example CLI).
difference vc9 vs vc11 vs vc14:
More recent versions of PHP are built with VC9, VC11 or VC14 (Visual Studio 2008, 2012 or 2015 compiler respectively) and include improvements in performance and stability.
- The VC9 builds require you to have the Visual C++ Redistributable for Visual Studio 2008 SP1 x86 or x64 installed
- The VC11 builds require to have the Visual C++ Redistributable for Visual Studio 2012 x86 or x64 installed
- The VC14 builds require to have the Visual C++ Redistributable for Visual Studio 2015 x86 or x64 installed
difference 86 vs 64:
The x64 builds of PHP for Windows should be considered experimental, and do not yet provide 64-bit integer or large file support.
Take a look at the XCache opcode cacher, from the authors of lighttpd. It supports both php 5.5 and user data cache: http://xcache.lighttpd.net/wiki/XcacheApi
I didn’t try it my self (still using APC and php 5.4).