php 64位与php_int_max = 2147483647

我已经安装WampServer 2.0有apache 2.4.4,mysql 5.6.12和php 5.4.12。 当我回声PHP_INT_MAX它给了我2147483647.我也回声phpinfo()和体系结构表示x64。 这假设不会发生,因为我的PHP是64位的权利? 我需要我的PHP支持64位整数。 我需要我的PHP_INT_MAX是9223372036854775807。

有人可以帮我吗? 谢谢

如果你正在运行一个Windows操作系统,wampserver建议你是, 这是你的答案 :

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

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

在文件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但是这是我所做的,所以我喜欢它:)

尝试PHP7 – 目前的主人http://windows.php.net/downloads/snaps/master/ 。 64位版本现在利用了64位Windows的所有功能。

转到“供应商/ 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__ . "\""); }*/ 

而已。

我试过php7,它的工作原理:

running php.exe -r "echo PHP_INT_MAX;"

并输出9223372036854775807