php 如何在windows中安装apcu
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24448261/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to install apcu in windows
提问by user3481997
回答by Robert
Thisshort and straight to the point tutorial should help you
这个简短而直接的教程应该可以帮助你
Install APCu on Windows
在 Windows 上安装 APCu
Assumptions
假设
- 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
- 我假设您知道什么是 APC - 替代 PHP 缓存
- 您想安装 APCu 因为 APC 不再与 PHP 5.5.x 兼容
- 您想为 wamp、xampp 安装 APCu。主要是用于 PHP 的 Windows Web 开发平台
Instructions
指示
Pre: All directory locations might be different for you depending on your wamp installation folder and your PHP/apache versions.
前:根据您的 wamp 安装文件夹和您的 PHP/apache 版本,所有目录位置对您来说可能不同。
- 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_apcu.dll
inC:\wamp\bin\php\php5.5.6\ext
. Go to
C:\wamp\bin\apache\apache2.4.9\bin
openphp.ini
and 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.
Restart wamp
- Go to http://localhost/phpinfo.phpand 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:\wamp\bin\php\php5.5.6\bin\php.ini
the config lines you added at step 5 in apache's php.ini.
- 转到http://pecl.php.net/package/APCu,有一个可用版本的表格
- 选择更适合您的版本(支持您的 php 版本的最新稳定版本)
- 从 DLL 列表中选择包,具体取决于您使用的 Windows:
- PHP 版本(在您的情况下为 5.5)
- x64(64 位)或x86(32 位窗口)
- 线程安全(为了 Apache 兼容性)
- 解压存档,复制
php_apcu.dll
进去C:\wamp\bin\php\php5.5.6\ext
。 转到
C:\wamp\bin\apache\apache2.4.9\bin
打开php.ini
并添加以下行(我只是在文件的结尾添加它们):[apcu] extension=php_apcu.dll apc.enabled=1 apc.shm_size=32M apc.ttl=7200 apc.enable_cli=1 apc.serializer=php
这是位于 php_apcu 存档的 INSTALL 文件中的推荐配置,DLL 文件的位置除外。
重启wamp
- 转到http://localhost/phpinfo.php并检查是否出现apcu 配置表并启用apcu
- 如果您还想将 apcu 用于 PHP CLI,那么您只需要
C:\wamp\bin\php\php5.5.6\bin\php.ini
在 apache 的 php.ini 中添加您在第 5 步中添加的配置行。
The end!
结束!
回答by Wirone
For those who want APCu with backward APC compatibility (1:1 replacement without changing codebase, for example apc_cache_info
> apcu_cache_info
)
对于那些希望 APCu 具有向后 APC 兼容性的人(1:1 替换而不更改代码库,例如apc_cache_info
> apcu_cache_info
)
Download
php_apcu.dll
from release page(choose proper PHP version, architecture and thread safety mode)Download
php_apcu_bc.dll
from PECLSave both files in
ext
dir under your PHP installation folderLoad extensions in
php.ini
:extension=php_apcu.dll extension=php_apcu_bc.dll
Configure APCu in
php.ini
[APCu] apc.enabled=1 apc.shm_size=32M apc.ttl=7200 apc.enable_cli=1 apc.serializer=php
php_apcu.dll
从发布页面下载(选择合适的 PHP 版本、架构和线程安全模式)php_apcu_bc.dll
从PECL下载将这两个文件保存
ext
在 PHP 安装文件夹下的 dir 中加载扩展
php.ini
:extension=php_apcu.dll extension=php_apcu_bc.dll
配置 APCu
php.ini
[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 php_apc.dll
)
信息:APCu-BC 1.0.3 的 APC 扩展必须准确命名php_apcu.dll
才能工作。当我将它命名为php_apcu_bc-1.0.3-7.1-ts-vc14-x86.dll
XAMPP 时没有正确启动(关于丢失的错误php_apc.dll
)
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.
附加说明:从上面的 vc15 源下载的 zip 文件包含一个名为 php_apc.dll 的文件(在文件中:'php_apcu_bc-1.0.4-7.2-ts-vc15-x86.zip' 日期:13/06/2018)-只需将其重命名为 php_apcu_bc.dll 即可。
回答by Ivan
Please refer to the official documentation:
https://secure.php.net/manual/en/opcache.installation.php
请参考官方文档:https:
//secure.php.net/manual/en/opcache.installation.php
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):
就我而言,我在 XAMPP 上使用 PHP 5.6,我需要做的就是php.ini
使用(推荐设置)更新我的文件:
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