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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 17:19:18  来源:igfitidea点击:

How to install apcu in windows

phpwindowsapc

提问by user3481997

How can I install APCu in Windows?

如何在 Windows 中安装 APCu?

I found this. But I need a solution for Windows.

我找到了这个。但我需要一个适用于 Windows 的解决方案。

I use PHP 5.5.6 (I have the XAMPP package).

我使用 PHP 5.5.6(我有 XAMPP 包)。

回答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 版本,所有目录位置对您来说可能不同。

  1. Go to http://pecl.php.net/package/APCu, there is a table with available releases
  2. Choose whatever release suits you better (latest stable version that supports your php version)
  3. 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)
  4. Unzip the archive, copy php_apcu.dllin C:\wamp\bin\php\php5.5.6\ext.
  5. Go to C:\wamp\bin\apache\apache2.4.9\binopen 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.

  6. Restart wamp

  7. Go to http://localhost/phpinfo.phpand check if apcu configuration table appears and apcu is enabled
  8. 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.inithe config lines you added at step 5 in apache's php.ini.
  1. 转到http://pecl.php.net/package/APCu,有一个可用版本的表格
  2. 选择更适合您的版本(支持您的 php 版本的最新稳定版本)
  3. 从 DLL 列表中选择包,具体取决于您使用的 Windows:
    • PHP 版本(在您的情况下为 5.5)
    • x64(64 位)或x86(32 位窗口)
    • 线程安全(为了 Apache 兼容性)
  4. 解压存档,复制php_apcu.dll进去C:\wamp\bin\php\php5.5.6\ext
  5. 转到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 文件的位置除外。

  6. 重启wamp

  7. 转到http://localhost/phpinfo.php并检查是否出现apcu 配置表并启用apcu
  8. 如果您还想将 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

  1. Download php_apcu.dllfrom release page(choose proper PHP version, architecture and thread safety mode)

  2. Download php_apcu_bc.dllfrom PECL

  3. Save both files in extdir under your PHP installation folder

  4. Load extensions in php.ini:

    extension=php_apcu.dll
    extension=php_apcu_bc.dll
    
  5. Configure APCu in php.ini

    [APCu]
    apc.enabled=1
    apc.shm_size=32M
    apc.ttl=7200
    apc.enable_cli=1
    apc.serializer=php
    
  1. php_apcu.dll发布页面下载(选择合适的 PHP 版本、架构和线程安全模式)

  2. php_apcu_bc.dllPECL下载

  3. 将这两个文件保存ext在 PHP 安装文件夹下的 dir 中

  4. 加载扩展php.ini

    extension=php_apcu.dll
    extension=php_apcu_bc.dll
    
  5. 配置 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.dllin order to work. When I named it php_apcu_bc-1.0.3-7.1-ts-vc14-x86.dllXAMPP 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.dllXAMPP 时没有正确启动(关于丢失的错误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.inifile 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

回答by Jenno Richi Benat

Download the .dll file from here

这里下载 .dll 文件

Edit the php.ini file and add the following line in the extensions section:

编辑 php.ini 文件并在扩展部分添加以下行:

extension = php_apc.dll