我可以在 Windows 上向 PHP 添加不是 DLL 文件的扩展吗?

发布于 2024-07-29 07:34:55 字数 263 浏览 10 评论 0 原文

我在其他地方问过这个问题,但那里的人似乎不明白我在说什么。

当我访问 PECL 网站时,发现的所有扩展名都位于 TGZ 文件内。
这不是问题,任何现代归档程序都可以打开它。

里面总是一个 .tar 文件,里面是源文件。 那么,我该怎么办呢? 我对使用 pecl_http 扩展特别感兴趣,但我不知道该怎么做。

注意:.TAR 文件内没有 DLL 文件。 没有任何一个,一个也没有。 您找到的只是 C 代码和 C 头文件。

I've asked this somewhere else, but the people there don't seem to understand what I am talking about.

When I go to the PECL website, all extensions found there are inside TGZ files.
Which is not a problem, any modern archiving program can open it.

Inside is always a .tar file and inside that are the source files.
So, what do I do with that? I'm particularly interested in using the pecl_http extension, but I'm not sure what to do.

Note: there are no DLL files inside the .TAR files. None whatsoever, not a single one. All you find is C code and C headers.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

迟月 2024-08-05 07:34:55

如果没有提供 .dll,则必须编译它:-(

前段时间有一个 pecl4win 网站,但它已关闭;而新的 http://windows.php.net/ 还没有扩展(正在进行工作,但 Windows 不是平台PHP 开发人员的选择,而不是核心开发人员的选择,所以它不会很快)。

你这样说:

.TAR 中没有 DLL 文件
文件。 没有任何一个,一个也没有
一。 你找到的只是 C 代码和 C
标头。

这意味着您必须自己编译扩展 :-( (也许您会很幸运,并在适合您的 PHP 版本的地方找到一个 .dll ;一些扩展,例如 Xdebug,在他们的官方网站上有这些,至少对于最新版本的 PHP...但情况并非总是如此:-( )

要使用 Windows 编译 PECL 扩展,您可以查看以下链接:

无论如何..祝你好运...

作为旁注:如果我没记错的话,Windows 的 PHP 安装程序捆绑了一些 PECL 扩展;也许这个就是其中之一?

If there is not .dll provided, you have to compile it :-(

There was a pecl4win website some time ago, but it's down ; and the new http://windows.php.net/ does not have extensions on it yet (there is work going on, but windows is not the platform of choice for PHP developpers, nor core-developpers, so it's not going really fast).

You say this :

there are no DLL files inside the .TAR
files. None whatsoever, not a single
one. All you find is C code and C
headers.

Which means you will have to compile the extension yourself :-( (maybe you'll get lucky, and find a .dll somewhere that fits your version of PHP ; some extensions, like Xdebug, have those on their official website, at least for recent versions of PHP... But it's not always the case :-( )

To compile a PECL extension with windows, you can take a look at these links :

Anyway... Good luck...

As a sidenote : if I remember correctly, the PHP's installer for windows has some PECL extensions bundled in ; maybe this one is one of those ?

放飞的风筝 2024-08-05 07:34:55

适用于 Windows 的 pecl 库集合,它们要么附加(作为单独的链接)到 PHP 下载页面(名为 XYZ-win32-pecl.zip 或类似名称),要么以某种方式链接(例如,最新的 PHP5 可以使用之前 5.X 设置中的 PECL,下载页面上是这么说的)。

如果您获得的只是源代码,则您将需要自己构建它们。

a) 下载 PHP 源代码(构建库并将它们链接到 Windows 上的 PHP 所需的大量标头),

b) 下载您想要构建的扩展,并将它们放在 /phpsource/src/ext/ 文件夹中,

c)准备您最喜欢的 C/C++ IDE(我更喜欢使用 VisualC++ 6.0,其唯一目的是在 Windows 上编写 PHP 扩展)

d) 创建构建环境,最后

e) 构建 ;-)

请注意,您将需要 PHP[ver]debug_ts .lib 或 PHP[ver]release_ts.lib 以正确链接它们。

除非你是为 PHP 4.4.4 构建它们(我用它来使用 BamCompile 开发 .exe 应用程序 - 一种迂回方式,但它很神奇),在这种情况下,只需将你的源代码发送给我,我将构建它如果我有时间的话你。 ;-) 也有可能,您正在寻找的扩展已经已经为其构建了一个 .dll。 只需获取扩展名,然后在 Google 中搜索“ php_NameOfTheExtension.dll PHPYourPHPVersionNumber ”,您就可能会找到它(尽管有一些,例如 php_openAl.dll)不以 .dll 形式存在)。

There ARE pecl library collections for Windows, and they're either appended (as a separate link) on PHP download page (named X.Y.Z-win32-pecl.zip or similar), or linked somehow (for example, the latest PHP5 can use PECL from the previous 5.X setup, and it says so on the download page).

If all You get is source code, You will need to build these yourself.

a) download PHP source code (a lot of headers required to build the libs and link them to PHP on Windows),

b) download the extensions You want to build, and put them in /phpsource/src/ext/ folder,

c) prepare Your favorite C/C++ IDE (I prefer to use VisualC++ 6.0 for the sole purpose of writing PHP extensions on Windows)

d) make a build environ, and finally

e) build ;-)

Do note You will need PHP[ver]debug_ts.lib or PHP[ver]release_ts.lib to link them properly.

Unless You're building them for PHP 4.4.4 (which I use to develop .exe apps using BamCompile - a roundabout way, but it works magic), in which case just send Your source code to me, I'll build it for You if I have time. ;-) Also chances are, the extension You're looking for HAS a .dll built for it already. Just take the name of the extension, and search Google for " php_NameOfTheExtension.dll PHPYourPHPVersionNumber " and You just might find it (although a few, like php_openAl.dll don't exist as .dll).

幽梦紫曦~ 2024-08-05 07:34:55

插件几乎总是使用共享库(也称为动态库)来实现,其中包含在运行时动态加载的函数。 在 Windows 上,共享库是 DLL,这就是为什么 PHP 的所有扩展(即插件)都以一个或多个 DLL 文件的形式出现。 如果您获得了插件的源代码,则需要将源代码构建(即编译并链接它)到 DLL 或 DLL 中。

具体如何构建源代码取决于特定的插件。 精心设计的源代码包将附带一个“README”文件,准确解释如何构建该包。 如果包包含一个名为“configure”的文件和另一个名为“Makefile”的文件,则构建过程几乎总是要调用:

./configure
make
sudo make install

在 Windows 上,必须使用 Cygwin 调用上述命令。 如果包包含 Visual Studio 项目文件,那么您可能可以使用它来构建源包。

Plugins are almost always implemented using a shared library (a.k.a. dynamic library), containing functions which are dynamically loaded at runtime. On Windows, shared libraries are DLLs, which is why all the extensions (i.e. plugins) for PHP have come in the form of one or more DLL files. If you are given the source code for a plugin, you will need to build the source code (i.e., compile and link it) into a DLL or into DLLs.

How exactly you build the source code depends on the specific plugin. A well-designed source package will come with a "README" file explaining exactly how to build the the package. If the package contains a file named "configure" and another named "Makefile", then the build process is almost always to invoke:

./configure
make
sudo make install

On Windows, the commands above would have to be invoked using Cygwin. If the package contains a Visual Studio project file, then you can probably use that the build the source package.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文