php 在 Windows 上安装 APC
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2437737/
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
Install APC on Windows
提问by Jiew Meng
How can I install APC on Windows? I am using PHP 5.3, Windows 7 x64.
如何在 Windows 上安装 APC?我使用的是 PHP 5.3,Windows 7 x64。
I used
我用了
pecl install apc
I got
我有
C:\PHP>pecl install apc
downloading APC-3.0.19.tgz ...
Starting to download APC-3.0.19.tgz (115,735 bytes) ............
done: 115,735 bytes 47 source files, building
WARNING: php_bin c:\php\php.exe appears to have a suffix \php.exe, but config
variable php_suffix does not match running: msdev APC.dsp /MAKE "APC - Release"
ERROR: Did not understand the completion status returned from msdev.exe.
回答by Pascal MARTIN
Installing an extension with the peclcommand means :
使用pecl命令安装扩展意味着:
- downloading the sources
- compiling them
- 下载资源
- 编译它们
And, generally speaking, a windows machine doesn't have what's required to compile software like PHP and/or PHP extensions.
而且,一般来说,Windows 机器没有编译 PHP 和/或 PHP 扩展等软件所需的东西。
A better / easier solution, in your case, would probably be to find a pre-compiled .dllof the extension, that matches your system and your version of PHP.
在您的情况下,更好/更简单的解决方案可能是找到.dll与您的系统和 PHP 版本相匹配的预编译扩展。
With a bit of luck, maybe one of the versions provided on http://downloads.php.net/pierre/could be OK ?
(It's what kind of acts as replacement of the old pecl4win, until the extensions for windows are available on windows.php.net)
运气好的话,也许http://downloads.php.net/pierre/ 上提供的版本之一可能没问题?
(在 windows.php.net 上提供 windows 扩展程序之前,它是旧 pecl4win 的替代品)
For more informations about which version you should use, take a look at the Which version do I choose?section, in the left side-bar of http://windows.php.net/
有关您应该使用哪个版本的更多信息,请查看我选择哪个版本?部分,在http://windows.php.net/的左侧栏中
回答by lubosdz
It is not really important, whether you are running Windows 32-bit or 64-bit version. What matters is what Apache (webserver) version you have installed (32/64). Since lots of PHP extensions (like APC) are not available for 64-bit systems, most common setup is as follows:
无论您运行的是 32 位还是 64 位版本的 Windows,这并不重要。重要的是您安装的 Apache(网络服务器)版本(32/64)。由于许多 PHP 扩展(如 APC)不适用于 64 位系统,因此最常见的设置如下:
Operating system 32 or 64-bit (not really important). Apache 32-bit will run easily on Windows 64-bit. The difference is, that for 32-bit apache you MUST install PHP 32-bit. Once you install 64-bit PHP, you may find difficult to install some extensions - there are almost no extensions available for 64-bit PHP platform.
therefore your webserver should be 32-bit if you care about special extensions, like APC, Imagick etc... Also you need to know if your apache is thread safe (TS) or not thread safe (NTS) and whether it has been compiled in Visual Studio 6 (VC6) or newser Visual Studio 2008 (VC9). You will easily find all this info from phpinfo() function.
as for the APC, some nice compilation for Windows are available from http://dev.freshsite.pl/php-accelerators/apc.html.
操作系统 32 或 64 位(不是很重要)。Apache 32 位将在 Windows 64 位上轻松运行。不同之处在于,对于 32 位 apache,您必须安装 PHP 32 位。一旦安装了 64 位 PHP,您可能会发现安装一些扩展很困难——几乎没有可用于 64 位 PHP 平台的扩展。
因此,如果您关心特殊的扩展,例如 APC、Imagick 等,您的网络服务器应该是 32 位的……此外,您还需要知道您的 apache 是线程安全 (TS) 还是非线程安全 (NTS) 以及它是否已编译在 Visual Studio 6 (VC6) 或新闻 Visual Studio 2008 (VC9) 中。您可以从 phpinfo() 函数中轻松找到所有这些信息。
至于 APC,可以从http://dev.freshsite.pl/php-accelerators/apc.html获得一些很好的 Windows 编译。
回答by kta
For php 5.3 you use php.net/pierre/php_apc-3.1.10-5.3-vc9-x86.zip.
对于 php 5.3,您使用 php.net/pierre/php_apc-3.1.10-5.3-vc9-x86.zip。
Download it and copy php_apc.dll to your php ext directory. (I choose the file under ts I have thread safe php installation. There is also an apc dll file for non thread safe.)
下载它并将 php_apc.dll 复制到您的 php ext 目录。(我选择ts下的文件我有线程安全的php安装。还有一个非线程安全的apc dll文件。)
Add extension=php_apc.dll into your php.ini file
将 extension=php_apc.dll 添加到您的 php.ini 文件中
Restart your web server
重新启动您的网络服务器
Run phpinfo() to see if it's installed or not.
运行 phpinfo() 以查看它是否已安装。
I am using php 5.4 and I downloaded php.net/pierre/php_apc-3.1.10-5.4-vc9-x86.zip and its working fine.
我正在使用 php 5.4,我下载了 php.net/pierre/php_apc-3.1.10-5.4-vc9-x86.zip 并且它工作正常。
Hope this will help mate.Good luck.
希望这会帮助队友。祝你好运。
回答by devilcius
There's no available versionfor php > 5.4. I'm using APCuinstead. Just download the dll and reference it in php.ini.
回答by Raivo
Also, make sure that the compiled version from here http://downloads.php.net/pierre/matches your php version, otherwise the extension will not load (php v. 5.2.17 requires php_apc.dll v 5.2.17.17 - which doesn't seem to be available as of this writing - I had to downgrade the php version to play with apc).
另外,请确保http://downloads.php.net/pierre/此处编译的版本 与您的 php 版本匹配,否则扩展将无法加载(php v. 5.2.17 需要 php_apc.dll v 5.2.17.17 - 其中在撰写本文时似乎不可用 - 我不得不降级 php 版本才能使用 apc)。
Another point, pierre's zip packages, at least the one I downloaded, did not include the management script. you can get it from here: http://pecl.php.net/package/APC- select the version you downloaded, then navigate to Browse Source, then find your version in the 'tags' folder. the apc.php script should be there.
还有一点,pierre 的 zip 包,至少我下载的那个,没有包含管理脚本。你可以从这里得到它:http: //pecl.php.net/package/APC- 选择你下载的版本,然后导航到浏览源,然后在“标签”文件夹中找到你的版本。apc.php 脚本应该在那里。
回答by Ahmad Alfy
This websiteoffers updated dll and installers for Apache, PHP and APC compiled to work on windows 64 bit. I've been using it for a while and it works fine. You could an APC version compatible with PHP 5.3.22 here
该网站为 Apache、PHP 和 APC 提供更新的 dll 和安装程序,这些程序已编译为可在 Windows 64 位上运行。我已经使用它一段时间了,效果很好。你可以在这里找到与 PHP 5.3.22 兼容的 APC 版本

