ext-decimal icon indicating copy to clipboard operation
ext-decimal copied to clipboard

Support of PHP 8.2 for Windows

Open syberon opened this issue 2 years ago • 12 comments

Hello!

When did you plan to release build of extension for newly release of PHP 8.2 for Windows?

syberon avatar Dec 24 '22 07:12 syberon

+1 i downloaded dll file from pecl but it seems to have a problem with php 8.2 PHP Startup: decimal: Unable to initialize module

mshadowz avatar Mar 26 '23 14:03 mshadowz

I have build it myself. These are the steps I noted:

Build php-decimal extension on windows

Based on https://wiki.php.net/internals/windows/stepbystepbuild_sdk_2 and PHP 8.2.

  • Install the Visual Studio Build Tool 2019. You will only need a single component:
    • MSVC v142 - VS 2019 C++ x64/x86 build tools (latest)
  • Download the extension source from pecl: https://pecl.php.net/get/decimal-1.4.0.tgz (can be found on PECL :: Package :: decimal (php.net))
  • Follow the instructions under "Building PECL extensions with phpize" under under PHP: internals:windows:stepbystepbuild_sdk_2
    • Make sure to run the steps in the developer console for visual studio 2019
    • Make sure to use --with-decimal instead of --enable-decimal
    • Make sure to have the libmpdec sources somewhere on your system and provide it as extra includes and libs
    • As reference, my final configure command: configure --with-extra-includes=D:\php\libmpdec-2.4.2-vc15-x64\include --with-extra-libs=D:\php\libmpdec-2.4.2-vc15-x64\lib --disable-all --with-decimal
  • Copy the generated dll in x64\Release to your PHP installations ext folder and enable it in the php.ini. Also make sure to place libmpdec.dll in the PHP installation root dir.
  • That's it!

Sources:

bobvandevijver avatar Jun 19 '23 15:06 bobvandevijver

@bobvandevijver Nice work. Just a tiny remark. If you do not put libmpdec.lib in your libs directory the build will use libmpdec_a.lib, which is the static library. Then you do not need libmpdec.dll in your PHP root directory. And the extension does not have any dependencies at all. I always prefer to build with the static libraries if a dependent dll is used in only 1 extension.

Jan-E avatar Jun 19 '23 16:06 Jan-E

@Jan-E Thanks for the addition! Did not know about that, already took me quite some to get it working due to the undocumented with-decimal instead of the expected enable-decimal to be honest 😅.

Just tried your suggestion, works like a charm. I agree with you that in this case a static library is more suitable.

If anybody needs it (and trusts my build), you can download it here for NTS x64: php_decimal.zip. This is the version with the library statically linked, so no need for the libmpdec.

bobvandevijver avatar Jun 19 '23 20:06 bobvandevijver

The difference between —with-extension and —enable-extension is always a bit arbitrary. —with-extension is often used with an argument, for instance a path to a dependency. I might give shot at changing the config.w32. It would be better if it defaults to the static library if it finds libmpdec_a.lib.

Jan-E avatar Jun 19 '23 20:06 Jan-E

See https://www.apachelounge.com/viewtopic.php?t=6359 The 64 bits PHP 8.2.7 contains php_decimal.dll now. And some other extensions: https://phpdev.toolsforresearch.com/php-8.2.7-nts-Win32-vs16-x64.htm

The 8.2.7 TS PHP is still compiling, but will be uploaded with php_decimal.php as well soon.

I was not aware that this extension existed, but browsed a bit around when @rtheunissen had merged a PR for the DS extension: https://github.com/php-ds/ext-ds/pull/195#event-9560572375

Jan-E avatar Jun 19 '23 22:06 Jan-E

Hey guys, thank you for this work. I'll create a new release for us. I am traveling at the moment but will be home later this week. I'll do the same for the other extensions too. I really want 2.0 released for this library, it's been ready for years now.

rtheunissen avatar Jun 19 '23 22:06 rtheunissen

@rtheunissen Before releasing 2.0 please review and merge https://github.com/php-decimal/ext-decimal/pull/73

Jan-E avatar Jun 21 '23 11:06 Jan-E

any update 2.0.0 :(

pandureynaldo avatar Apr 08 '24 03:04 pandureynaldo

Hi,

I Have build this extension for Windows. You can get the build here: https://phpext.phptools.online/extension/math/decimal-144

macintoshplus avatar May 17 '24 07:05 macintoshplus

@pandureynaldo, I don't build the 2.0 version because it's an alpha version and older than 1.5.0. You can request a build for the 2.0 version if you want I try to build it. https://phpext.phptools.online/extension/math/decimal-144

Please consider support to help me to maintain this service. https://www.paypal.com/donate/?hosted_button_id=PV3Q72NSPYQQ4

macintoshplus avatar May 17 '24 07:05 macintoshplus

I think I just need to release 2.0 properly.

rtheunissen avatar May 17 '24 16:05 rtheunissen