microsoft / php-sdk-binary-tools

Tool kit for building PHP under Windows
BSD 2-Clause "Simplified" License
271 stars 78 forks source link

Add exact requirements / better install manual to readme.md #70

Closed c33s closed 3 years ago

c33s commented 4 years ago

just trying to build postal-php and struggling with the php compile manual https://wiki.php.net/internals/windows/stepbystepbuild_sdk_2 and the php-sdk manual.

for example the info in the readme is not very exact:

Visual C++ 2017 or Visual C++ 2019 must be installed prior SDK usage. Required components

C++ dev
Windows SDK
.NET dev

what is "C++ dev" is it "VC++ 2017 version 15.9 v14.16"? something else? which .net dev is required? why i need .net for a c php extension? what about the windows sdk? what if i need the php extension on an old win7 machine? can i build it on win10? can i build it directly on win7? can i build a win7 ext on linux? is there a docker image where i can download i complete cli build env so i can make autobuild on for example gitlab-ci?

(i can do a PR if i have gathered all required informations)

https://stackoverflow.com/questions/62162268/how-to-compile-a-php-7-4-extension-for-windows-and-which-visual-studio-component

cmb69 commented 4 years ago

just trying to build postal-php

That won't work out-of-the-box anyway, since config.w32 is missing; see https://github.com/openvenues/php-postal/issues/16#issuecomment-638248534 for some hints in this regard.

what is "C++ dev" is it "VC++ 2017 version 15.9 v14.16"? something else?

First, if you only want to build and don't have the need for the Visual Studio IDE, you can use the Build Tools for Visual Studio. Direct download: https://aka.ms/vs/15/release/vs_buildtools.exe. It is usually suffient to install the "Visual C++ build tools" workload from the installer.

why i need .net for a c php extension?

This is only needed if you want to have support for Dotnet class of the com_dotnet extension.

what about the windows sdk?

The Windows SDK will be installed as part of the "Visual C++ build tools" workload.

what if i need the php extension on an old win7 machine? can i build it on win10? can i build it directly on win7?

The binaries are supposed to be portable (of course, you need the respective VC runtime installed on the other machines).

can i build a win7 ext on linux?

No, cross-compilation is not supported.

See also https://gist.github.com/cmb69/47b8c7fb392f5d79b245c74ac496632c, which is about setting up a minimal build environment for php-src/master (i.e. it uses VS 2019).

Also note, that for building individual PHP extensions, using phpize is the simplest option (although that is not documented yet, to my knowledge). The usage is pretty much the same as on Linux, though.

cmb69 commented 4 years ago

This screenshot shows the selection of the "Visual C++ build tools" workload:

Capture

Also note that building PHP 7.4 extensions should also work with VS 2019, but you need respective dependencies (this are not provided by the PHPonWindows team), and using such extension binaries with official PHP binaries may also not be supported.

dalehhirt commented 3 years ago

Closing as resolved.