internals:windows:stepbystepbuild_sdk_2

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
internals:windows:stepbystepbuild_sdk_2 [2021/02/01 09:56]
cmb Document mitigation for C1047
internals:windows:stepbystepbuild_sdk_2 [2022/01/10 09:43] (current)
cmb use php fork of php-sdk-binary-tools
Line 19: Line 19:
   * Visual C++ 15.0 (Visual Studio 2017) for **PHP 7.2**, **PHP 7.3** or **PHP 7.4**.   * Visual C++ 15.0 (Visual Studio 2017) for **PHP 7.2**, **PHP 7.3** or **PHP 7.4**.
   * Visual C++ 16.0 (Visual Studio 2019) for **master**.   * Visual C++ 16.0 (Visual Studio 2019) for **master**.
 +
 +Always keep your installed Visual C++ up to date. Otherwise build errors may occur due to dependencies built with newer versions.
  
 Support for a certain Visual Studio version means only support for its default platform toolset; building PHP with a non-default platform toolset (such as 14.16 with Visual Studio 2019) may work, but is not recommended. Support for a certain Visual Studio version means only support for its default platform toolset; building PHP with a non-default platform toolset (such as 14.16 with Visual Studio 2019) may work, but is not recommended.
Line 26: Line 28:
 ==== Setup ==== ==== Setup ====
    
-  * Fetch the latest stable SDK tag from https://github.com/Microsoft/php-sdk-binary-tools+  * Fetch the latest stable SDK tag or HEAD from https://github.com/php/php-sdk-binary-tools
     * The new PHP SDK is required, when building PHP 7.2+     * The new PHP SDK is required, when building PHP 7.2+
     * Read the PHP SDK specific notes on the Github repository page     * Read the PHP SDK specific notes on the Github repository page
Line 66: Line 68:
     * clone the [[http://git.php.net/|PHP Git repository]] ([[https://github.com/php/php-src|GitHub mirror]])     * clone the [[http://git.php.net/|PHP Git repository]] ([[https://github.com/php/php-src|GitHub mirror]])
   - Get the binary tools:   - Get the binary tools:
-    * available from [[https://github.com/Microsoft/php-sdk-binary-tools]]+    * available from [[https://github.com/php/php-sdk-binary-tools]]
     * either fetch a tag as zip, or clone the git repository and checkout the tag     * either fetch a tag as zip, or clone the git repository and checkout the tag
   - Get the libraries on which PHP depends:   - Get the libraries on which PHP depends:
Line 135: Line 137:
  
 At this point, your compiled extension will be located in the release directory. At this point, your compiled extension will be located in the release directory.
 +
 +==== Building PECL extensions with phpize ====
 +
 +Alternatively to the "in-tree" build described above, you can do a "phpize" build, what is mostly useful if you don't need to build PHP from source, but rather use a pre-built PHP binary package.
 +
 +  - Download and unpack the development package which corresponds to your pre-built PHP version and variant from https://windows.php.net/
 +  - Download and unpack the source of the PECL extension
 +  - Invoke the starter script to automatically setup the environment for the desired build config, e.g. ''c:\php-sdk\phpsdk-vs16-x64.bat''
 +  - Add the development package folder and the PHP folder to the ''PATH''
 +  - Enter the source folder of the PECL extension
 +  - Run ''phpize''
 +  - Run ''configure --help'' to see the list of configuration options
 +    * the most important option is the one which enables the extension to be built (e.g. ''--enable-apcu'')
 +    * another important options is ''--with-prefix'' which expects the PHP folder to be passed
 +    * if the extension depends on C libraries, you need to download these and put them either in the ''--with-php-build'' folder, or use the ''--with-extra-includes'' and ''--with-extra-libs'' options; suitable pre-built libraries can be found on https://windows.php.net/downloads/php-sdk/deps/ and https://windows.php.net/downloads/pecl/deps/
 +    * there may be further interesting configuration options, e.g. those which allows to configure details of the extension to be built
 +  - Run ''configure'' with the desired options
 +  - Run ''nmake''
 +  - After successful compilation, the build artifacts are located in the release folder
 +  - If the extension has a PHPT test suite, run ''nmake test''
 +
 +If you want to build your extension via Github Actions, consider to use https://github.com/cmb69/setup-php-sdk.
 +
 +==== Release directories ====
 +
 +When you have successfully compiled PHP, the release directory can be one of multiple, depending on the build configuration:
 +
 +    - `Release`: Release NTS build
 +    - `Release_TS`: Release ZTS build
 +    - `Debug`: Debug NTS build
 +    - `Debug_TS`: Debug ZTS build
 +
 +If you are compiling using a 64-bit compiler, then these directories will be located in a directory called `x64`.
  
 ===== Pitfalls ===== ===== Pitfalls =====
internals/windows/stepbystepbuild_sdk_2.1612173367.txt.gz · Last modified: 2021/02/01 09:56 by cmb