How to install apcu in windows – Here in this article, we will share some of the most common and frequently asked about PHP problem in programming with detailed answers and code samples. There’s nothing quite so frustrating as being faced with PHP errors and being unable to figure out what is preventing your website from functioning as it should like php and windows . If you have an existing PHP-based website or application that is experiencing performance issues, let’s get thinking about How to install apcu in windows.
How can I install APCu in Windows?
I found this. But I need a solution for Windows.
I use PHP 5.5.6 (I have the XAMPP package).
This short and straight to the point tutorial should help you
Install APCu on Windows
- I assume that you know what is APC – Alternative PHP cache
- You want to install APCu because APC is not compatible anymore with PHP 5.5.x
- You want to install APCu for wamp, xampp. Mostly windows web development platforms for PHP
Pre: All directory locations might be different for you depending on your wamp installation folder and your PHP/apache versions.
- Go to http://pecl.php.net/package/APCu, there is a table with available releases
- Choose whatever release suits you better (latest stable version that supports your php version)
- Choose package from DLL list, depending on what Windows you are using:
- PHP version (5.5 in your case)
- x64 (64 bits) OR x86 (32 bits windows)
- Thread Safe (for Apache compatibility)
- Unzip the archive, copy
php.iniand add the following lines (I just added them at the end of the file):
[apcu] extension=php_apcu.dll apc.enabled=1 apc.shm_size=32M apc.ttl=7200 apc.enable_cli=1 apc.serializer=php
This are recommended configurations located in INSTALL file from the php_apcu archive, excepting the location of the DLL file.
- Go to http://localhost/phpinfo.php and check if apcu configuration table appears and apcu is enabled
- If you also want to use apcu for PHP CLI then you only need to add in
C:wampbinphpphp5.5.6binphp.inithe config lines you added at step 5 in apache’s php.ini.
For those who want APCu with backward APC compatibility (1:1 replacement without changing codebase, for example
php_apcu.dllfrom release page (choose proper PHP version, architecture and thread safety mode)
Save both files in
extdir under your PHP installation folder
Load extensions in
Configure APCu in
[APCu] apc.enabled=1 apc.shm_size=32M apc.ttl=7200 apc.enable_cli=1 apc.serializer=php
INFO: APC extension with APCu-BC 1.0.3 must be named exactly
php_apcu.dll in order to work. When I named it
php_apcu_bc-1.0.3-7.1-ts-vc14-x86.dll XAMPP did not start properly (error about missing
Additional Note: the downloaded zip file from the source above for vc15 contained a file named php_apc.dll (in file: ‘php_apcu_bc-1.0.4-7.2-ts-vc15-x86.zip’ date: 13/06/2018) – just renaming it to php_apcu_bc.dll worked.
It matters if you use the thread safe or non thread safe version of the DLL. For me only the NTS worked in Windows 10 x64 and PHP 7.4 using the PHP built in server.
It was confusing because the error msg PHP gave when run php -i was Unable to load dynamic library ‘php_apcu.dll’ (tried: extphp_apcu.dll) as if the file was not there.
Please refer to the official documentation:
In my case, I’m using PHP 5.6 on XAMPP
and everything I need to do is to update my
php.ini file with (recommended settings):
opcache.memory_consumption=128 opcache.interned_strings_buffer=8 opcache.max_accelerated_files=4000 opcache.revalidate_freq=60 opcache.fast_shutdown=1 opcache.enable_cli=1