适用于 Windows 的 PHP UUID 扩展 DLL 文件

发布于 2024-08-31 08:07:47 字数 154 浏览 3 评论 0原文

当我尝试使用 php 代码连接到 Apache Cassandra 服务器时,出现错误“致命错误:调用未定义的函数 uuid_make()”。我发现 PHP 安装中缺少 PHP UUID 扩展。任何人都可以建议我从哪里可以下载用于在 Windows 7 计算机中安装 PHP 的 DLL 文件。

When i tried to connect to Apache Cassandra server using the php code i got an error "Fatal error: Call to undefined function uuid_make()". I can find that PHP UUID extension was missing in PHP installation. Can anyone please suggest from where i can download the DLL file for PHP installation in my Windows 7 Machine.

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

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

发布评论

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

评论(2

回梦 2024-09-07 08:07:47

由于在线没有 PHP UUID 扩展的 .dll 文件...您需要从源代码编译它。这应该不会太难...

在这里下载:
http://pecl.php.net/package/uuid

按照此处的说明进行操作:
http://php.net/manual/en/install.pecl.windows.php

您还可以直接从 PECL 安装,说明如下:
http://wiki.php.net/internals/windows/stepbystepbuild

Since there's no .dll file for the PHP UUID extension available online... you need to compile it from source. It shouldn't be too hard...

Download it here:
http://pecl.php.net/package/uuid

Follow the instructions here:
http://php.net/manual/en/install.pecl.windows.php

You can also install directly from PECL, instructions here:
http://wiki.php.net/internals/windows/stepbystepbuild

与之呼应 2024-09-07 08:07:47

不幸的是,PECL UUID 扩展是特定于操作系统的,并且只能在 Linux(包括 OS X)或 Solaris 上工作。

在 Windows 上,您有几个替代选项:

  • 查看 com_create_guid ( http://php.net/manual/en/function.com-create-guid.php)这是一个仅限 Windows 的 PHP 函数。

  • MySQL 有一个名为 UUID 的函数 (http:// /dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html#function_uuid)将生成一个 UUID,使用类似“SELECT UUID()”的内容作为 SQL 查询。 (我还没有测试过这是否可以在 Windows 版本上使用,如果您确实使用它,请发表回复,让大家知道您是如何使用的)

  • 如果您不担心 UUID 的唯一性(原因是UUID 是要尽可能确保在应用程序的生命周期中不会生成两个相同的值),然后您可以尝试一些纯 PHP 实现。这不是最理想的解决方案,我永远不会在生产中这样做,但它可能足以满足您的需求 - 网络上有很多可以用来获取灵感。

Unfortunately the PECL UUID extension is OS specific and will only work on Linux (including OS X) or Solaris.

On windows you have a couple of alternative options:

  • Check out com_create_guid (http://php.net/manual/en/function.com-create-guid.php) which is a Windows Only PHP function.

  • MySQL has a function called UUID (http://dev.mysql.com/doc/refman/5.5/en/miscellaneous-functions.html#function_uuid) which will generate a UUID, use something like "SELECT UUID()" as your SQL query. (I have not tested that this is available on Windows builds, if you do use it please post a reply to let everyone know how you got on)

  • If you are not worried about the uniqueness of your UUID (the reason for a UUID is to be as certain as possible that you won't generate two identical values ever in the lifetime of your application) then you could try some pure PHP implementation. It is not the most desirable solutions and I would never do this in production, but it might be enough for your needs - there are plenty out there on the web to use for inspiration.

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