[英]How to find out if a shared hosting is running 32 or 64 bit - with php
Is it possible to identify Linux 32 or 64 bit, using PHP? 是否可以使用PHP识别Linux 32或64位?
phpinfo()
returns 回报
Linux infong 2.4 #1 SMP Mon Oct 10 09:34:36 UTC 2011 i686 GNU/Linux
It's shared hosting so I cant use command line. 它是共享主机,所以我不能使用命令行。
Do a simple test: 做一个简单的测试:
var_dump(is_int( 9223372036854775807 ));
For 32-bit environment it will return false as this number is much bigger that maximum 32-bit integer. 对于32位环境,它将返回false,因为此数字远大于最大32位整数。 For 64-bit environment it will return true.
对于64位环境,它将返回true。
Or use PHP_INT_MAX as mario suggested in comments. 或者在评论中使用PHP_INT_MAX作为马里奥。
echo (PHP_INT_MAX == 2147483647)?'32-bit':'64-bit';
Or use PHP_INT_SIZE: 或者使用PHP_INT_SIZE:
echo (PHP_INT_SIZE * 8) . '-bit';
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.