Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I determine whether my OS is 32 or 64 bit?

I tried using <?php echo php_uname("m"); ?>, it returns i586 but I am on Windows 7 64 bit which I could see in My Computers Properties. So I am expecting x86_64 in output. Does any one know how to determine OS Architecture in PHP ?

I want the same thing for Mac OS X too. Any help would be appreciated.

like image 957
Jigar D Avatar asked Dec 02 '22 00:12

Jigar D


2 Answers

Here is a php solution :)

echo strlen(decbin(~0));
like image 55
alecsammon Avatar answered Dec 05 '22 01:12

alecsammon


more simple

echo 8 * PHP_INT_SIZE;
like image 29
user3665589 Avatar answered Dec 05 '22 01:12

user3665589