在 Windows 上安装 PHP 扩展
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/250766/
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
Installing PHP extensions on Windows
提问by picardo
I am using a Windows XP Home Edition. I need to install a few extensions to PHP -- memcache, APC, .etc. And I would very much like to use PECL to make this happen. The problem is PECL takes it for granted that I will have certain programs on my computer. On another post, I read, for instance, that you need to have Microsoft Visual Studio C++ installed on your machine. However, the new version of Visual Studio, which I downloaded, does not have msdev.exe and instead uses vcbuild.exe, which has a completely different api and fails to compile the .dsp files that come with these modules.
我使用的是 Windows XP 家庭版。我需要为 PHP 安装一些扩展——memcache、APC、.etc。我非常想使用 PECL 来实现这一点。问题是 PECL 认为我的计算机上会有某些程序是理所当然的。例如,在另一篇文章中,我读到您需要在您的机器上安装 Microsoft Visual Studio C++。但是,我下载的新版 Visual Studio 没有 msdev.exe,而是使用 vcbuild.exe,它具有完全不同的 api,并且无法编译这些模块附带的 .dsp 文件。
So I tried to find a script that would upgrade the dsp to work with vcbuild.exe...and it turns out vcbuild.exe can do that, but of course that didn't pan out.
所以我试图找到一个脚本来升级 dsp 以与 vcbuild.exe 一起工作......结果证明 vcbuild.exe 可以做到这一点,但当然这并没有成功。
Another thing I tried was to find a make script for Windows (nmake2make). But there was no make file in the module's root folder.
我尝试的另一件事是为 Windows (nmake2make) 找到一个 make 脚本。但是模块的根文件夹中没有 make 文件。
I tried also downloading Cygwin and MinGW in hopes of finding a build script that would work as simply as in *nix operating systems, but to no avail.
我还尝试下载 Cygwin 和 MinGW,希望找到一个可以像在 *nix 操作系统中一样简单工作的构建脚本,但无济于事。
How else do I use install PHP extensions on a Windows machine? Can anyone help me out of this predicament?
我如何在 Windows 机器上使用安装 PHP 扩展?任何人都可以帮助我摆脱这种困境吗?
回答by Harry Mumford-Turner
For all peoples coming here to download the dllextension files.
对于所有来这里下载dll扩展文件的人。
This is the link to the PHP extension download link http://windows.php.net/download/
这是 PHP 扩展下载链接的链接http://windows.php.net/download/
And this is a list of PHP extensions to download: http://pecl.php.net/package-search.php
这是要下载的 PHP 扩展列表:http: //pecl.php.net/package-search.php
For core extensions, or if you cant find any on pecl.php.net, download PHP from a zip http://windows.php.net/download/and look inside of /ext and copy them to your local php /ext folder.
对于核心扩展,或者如果您在 pecl.php.net 上找不到任何扩展,请从 zip http://windows.php.net/download/下载 PHP并查看 /ext 的内部并将它们复制到您本地的 php /ext 文件夹.
回答by AntonioCS
For memcache you will need the memcache server located here -> http://code.jellycan.com/memcached/and download the win32 binary
对于内存缓存,您将需要位于此处的内存缓存服务器 -> http://code.jellycan.com/memcached/并下载 win32 二进制文件
Never used APC :P I use eAccelerator0953_5.2.6 to cache the code
没用过 APC :PI 用 eAccelerator0953_5.2.6 来缓存代码
回答by Robert K
The only way I can think of is: manually. Yeah, I know, but this is pretty easy comparatively.
我能想到的唯一方法是:手动。是的,我知道,但相对来说这很容易。
If you have the compiler, then you can at least compile an extension if you have the source. Otherwise you're stuck with trying to locate a binary distribution (like me).
如果你有编译器,那么你至少可以编译一个扩展,如果你有源代码。否则你会被困在试图定位一个二进制发行版(像我一样)。
Here's what you do, from what I understand:
根据我的理解,这就是你所做的:
- Put the extension library folder under PHP's install path. On my computer this is
C:\xampp\php\ext. Search in your PHP.ini for "extension_dir" to find what yours is. - Edit php.ini to load the extension.
- Find
; Dynamic Extensions ;. - Add line
extension=my_lib.dll
- Find
- 将扩展库文件夹放在 PHP 的安装路径下。在我的电脑上,这是
C:\xampp\php\ext. 在您的 PHP.ini 中搜索“extension_dir”以找到您的。 - 编辑 php.ini 以加载扩展。
- 查找
; Dynamic Extensions ;。 - 添加行
extension=my_lib.dll
- 查找
This should do it. Otherwise you should probably search for an in-depth guide on manual installation.
这应该这样做。否则,您可能应该搜索有关手动安装的深入指南。

