Vahid Najafi
Vahid Najafi

Reputation: 5253

windows php 64 bit systems ATM

I'm using this php library. It mentiones this:

This project can run on PHP 7, PHP 5.6 and HHVM, only 64 bit systems are supported ATM.

It works fine in a linux host (cpanel) with php5.6. But doesn't work in windows. I installed wamp. In phpinfo(), it seems everything is ok. Is there anything I'm missing? What is ATM means?

My phpinfo():

enter image description here

Error:

Fatal error: Uncaught exception 'danog\MadelineProto\Exception' with message 'MadelineProto supports only 64 bit systems ATM' in C:\wamp64\www\telegramphp3\src\danog\MadelineProto\API.php on line 30

Upvotes: 0

Views: 421

Answers (2)

Seth
Seth

Reputation: 1255

Their API.php contains the following code:

// Detect 64 bit
if (PHP_INT_SIZE < 8) {
    throw new Exception('MadelineProto supports only 64 bit systems ATM');
}

What they're doing is not check whenever or not you're running a 64-bit build of PHP or if if your system is 64 bit but rather what the size in bytes for an integer is. That value can be either 4 (32 bit) or 8 (64 bit) on PHP7 (current Windows builds). In older versions of PHP (at least in the 64 bit builds for 5.6, which are marked experimental) that value is going to be always 4.

So in order to use that library on your system you would need to:

  • Upgrade your PHP version to 7
    • The current Windows builds can be found here, you could try to just replace your current PHP installation or look for an updated package of your ... package.

Upvotes: 2

GolezTrol
GolezTrol

Reputation: 116110

This happens, because the library checks for 64 bit by checking the constant PHP_INT_SIZE. This constant is always 4 on Windows, when you are using PHP 5.6, even on 64 bit systems. For this issue on Windows, see PHP_INT_SIZE returns 4 But my Operating System Is 64 bit

The 'problem' can be found in API.php around line 29. This check, however incorrect, seems to be the recommended way to check for 64 bit. Regardless, if they really rely on 8 bit integers, I think you can't use this library on Windows with PHP 5.6.

PHP 7 does support 64 bit integers on Windows, so I think you should upgrade to PHP 7 if you want to use this library.

Upvotes: 1

Related Questions