bitcoin-php icon indicating copy to clipboard operation
bitcoin-php copied to clipboard

Can't install with composer on windows php version Error

Open dagogodboss opened this issue 7 years ago • 6 comments

I can't install this libirary using composer as it says php version error it requires 64 bit php and xampp don't have 64 bit for windows system all 32 bit how do I fixed this

composer require bitwasp/bitcoin
Using version ^1.0 for bitwasp/bitcoin
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for bitwasp/bitcoin ^1.0 -> satisfiable by bitwasp/bitcoin[v1.0.0].
    - bitwasp/bitcoin v1.0.0 requires php-64bit >=7.0 -> your PHP version (7.1.11) does not satisfy that requirement.


Installation failed, reverting ./composer.json to its original content.

dagogodboss avatar Jan 03 '19 09:01 dagogodboss

Hmm, that started out because of something around here: https://github.com/Bit-Wasp/bitcoin-php/blob/master/src/Key/Deterministic/HierarchicalKey.php#L275

I can't remember if the issue still applies, I don't think there was a regression test written for the issue. To lift the 64bit constraint, we'd need tests ensuring that the bug can't happen again.

Pretty sure it only affected deriving hardened keys on 32 bit, because the last bit on that architecture is also the 'sign bit' reserved by PHP integers to contain whether the number is positive or negative. somehow the wrong serialization was generated back then, and hence the wallet is unportable due to the machine architecture. It was either in HD or the ElectrumKey derivation.

I have no free time for the next while, but it would be a great contribution.

I'd probably approach it like: determine exactly why we added the 64 bit requirement, check if the issue still persists on 32 bit, write tests reproducing the error or which fail if a regression occurs, and see if pack(N or V) fixes the issue for us compared to the original implementation.

Edit: does docker work on windows? you might be able to install a tiny PHP container, and mount the folder your code is in into the container, and test it out there. I often get into a mess after installing multiple php versions, but containers can be a useful way to get a different environment up and running fast.

afk11 avatar Jan 03 '19 15:01 afk11

So when will it be fixed

dagogodboss avatar Jan 05 '19 06:01 dagogodboss

But to forcefully install it I Did this composer require --ignore-platform-reqs bitwasp/bitcoin on a 32 bit php, but I am hoping with will cause future problems. I think you should add this to the ReadMe to help others with 32-Bits System. Thanks for this wonderfull library.

dagogodboss avatar Jan 05 '19 06:01 dagogodboss

@dagogodboss in case you missed it, that can cause you to lose bitcoins. so it's not really a good idea to ignore those.

hence the wallet is unportable due to the machine architecture.

I know since no one else complained about this in two years, most users don't develop on 32-bit or use it in production. So it's not a priority for me either, but is something I'd accept if you submitted a PR

I'd probably approach it like: determine exactly why we added the 64 bit requirement, check if the issue still persists on 32 bit, write tests reproducing the error or which fail if a regression occurs, and see if pack(N or V) fixes the issue for us compared to the original implementation.

afk11 avatar Jan 05 '19 13:01 afk11

Ok my system is 64Bits but it is xampp I try changing the php to a 64 bits php but it is not working with xampp.

dagogodboss avatar Jan 05 '19 14:01 dagogodboss

Sorry for the delay. I don't really have a suggestion for you, besides docker on windows, a linux VM, or using linux. I've never heard of someone deploying this lib on windows servers, nor have any fixes been submitted so the library runs on windows..

Unfortunately you'll have to investigate your environment by yourself.

afk11 avatar Mar 09 '20 16:03 afk11