0

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
Vahid Najafi
  • 4,654
  • 11
  • 43
  • 88
  • 2
    ATM just means "At the moment", so your version should be fine. Please explain *"But doesn't work in windows."*. What behaviour do you get? Errors? Specific (incorrect) output? – GolezTrol Jan 26 '17 at 10:14
  • @GolezTrol Thanks. I added the errors in the question. – Vahid Najafi Jan 26 '17 at 10:19
  • you're probably using a 32-bit version of PHP on a 64-bit version of windows – Grey Jan 26 '17 at 10:22
  • @Grey No! Before wamp, I was using `xampp`. In the xampp, architecture was **x86** – Vahid Najafi Jan 26 '17 at 10:24
  • WAMPServer has many PHP versions available as ADDONS to WAMPServer 3 and above [See here for all the ADDONS](http://wampserver.aviatechno.net/) You must use PHP7 or above on windows for a truely 64 bit version of PHP. Before that PHP was just experimental as far as 64bit goes on Windows and 64 bit integers did not actually exists, until PHP7 – RiggsFolly Jan 26 '17 at 14:27

2 Answers2

2

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.
Seth
  • 1,215
  • 15
  • 35
  • 1
    WAMPServer has many PHP versions available as ADDONS to WAMPServer 3 and above [See here for all the ADDONS](http://wampserver.aviatechno.net/) So dont do as @Seth suggests and get a version of PHP from his link. Installing the WAMPServer PHP ADDONS is download/ click and go – RiggsFolly Jan 26 '17 at 14:26
1

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.

Community
  • 1
  • 1
GolezTrol
  • 114,394
  • 18
  • 182
  • 210