7

我已经安装了具有 apache 2.4.4、mysql 5.6.12 和 php 5.4.12 的 WampServer 2.0。当我回显 PHP_INT_MAX 时,它给了我 2147483647。我也回显了 phpinfo() 并且架构指示 x64。这假设不会发生,因为我的 php 是 64 位的,对吗?我需要我的 php 支持 64 位整数。我需要我的 PHP_INT_MAX 为 9223372036854775807。

有人可以帮助我吗?谢谢

4

5 回答 5

10

如果您正在运行 Windows 操作系统,wampServer 建议您这样做,这就是您的答案

在 windows x86_64 上,PHP_INT_MAX 是 2147483647。这是因为在底层 c 代码中,long 是 32 位的。

请注意,这并不意味着 Windows 不支持 64bit int's:int64_t确实存在,但 PHP AFAIK 不使用它。
我设法想出了这个链接,在那个页面上,有一些你可以使用的代码,为你的代码添加对 64 位整数的支持

于 2013-07-24T14:39:39.040 回答
4

在文件RequestUtil.php中,它执行以下检查:

if (strlen((string) PHP_INT_MAX) < 19) {
    // Looks like we're running on a 32-bit build of PHP.  This could cause problems because some of the numbers
    // we use (file sizes, quota, etc) can be larger than 32-bit ints can handle.
    throw new \Exception("The Dropbox SDK uses 64-bit integers, but it looks like we're running on a version of PHP that doesn't support 64-bit integers (PHP_INT_MAX=" . ((string) PHP_INT_MAX) . ").  Library: \"" . __FILE__ . "\"");
}

您可以将其注释掉并尝试从那里破解您的方式。

如果我是你,我会使用字符串而不是整数编写自己的 Dropbox API 实现。

PS但这就是我所做的,所以我很享受:)

于 2013-07-24T15:01:30.430 回答
1

试试 PHP7 - 当前的大师http://windows.php.net/downloads/snaps/master/。64 位版本现在利用了 64 位 Windows 的所有功能。

于 2015-05-25T00:27:12.300 回答
1

转到 'vendor/dropbox/dropbox-sdk/lib/Dropbox'
并在 RequestUtil.php 中注释第 19-23 行。

评论此部分:

/*if (strlen((string) PHP_INT_MAX) < 19) {
    // Looks like we're running on a 32-bit build of PHP.  This could cause problems because some of the numbers
    // we use (file sizes, quota, etc) can be larger than 32-bit ints can handle.
    throw new \Exception("The Dropbox SDK uses 64-bit integers, but it looks like we're running on a version of PHP that doesn't support 64-bit integers (PHP_INT_MAX=" . ((string) PHP_INT_MAX) . ").  Library: \"" . __FILE__ . "\"");
}*/

而已。

于 2016-05-08T03:02:33.627 回答
-1

我尝试了 php7 并且它有效:

running php.exe -r "echo PHP_INT_MAX;"

它输出9223372036854775807

于 2015-12-09T21:57:45.773 回答