Build on Windows


Follow these instructions to build Ice in your Windows system. This guide is based on Build your own PHP on Windows and shows how to build using Visual C++ 15.0 (Visual Studio 2017) for PHP 7.2+.

Requirements

  1. Get the Visual C++ 15.0 compiler, it's in Visual Studio 2017 Community.
  2. Get the PHP source from Stable releases (click the Download source code).
  3. Get the latest binary tools from php-sdk-binary-tools.
  4. Get the Ice framework.

Prepare build

Use the x64 Native Tools Command Prompt. All commands in the rest of this document should be run in the appropriate command prompt.

  1. Create the build directory c:\php-sdk.
  2. Unpack the binary tools archive into this directory.
  3. Open the command prompt, enter the build directory and invoke the starter script:
    cd c:\php-sdk\
    phpsdk-vc15-x64.bat
  4. Run the buildtree batch script which will create the desired directory structure:
    bin\phpsdk_buildtree.bat phpdev
    • The buildtree script hasn't been updated for newer versions of VC++, so copy C:\php-sdk\phpdev\vc14 to C:\php-sdk\phpdev\vc15.
  5. Extract the PHP source code to C:\php-sdk\phpdev\vc15\x64\php-7.2.11-src if x64 is your architecture and 7.2.11 is the version number.
  6. Use the PHP SDK tools to fetch the suitable dependencies automatically by calling:
    cd phpdev\vc15\x64\php-7.2.11-src
    c:\php-sdk\bin\phpsdk_deps.bat -u
  7. Extract Ice source code, copy & rename the build\php7\ directory to C:\php-sdk\phpdev\vc15\x64\php-7.2.11-src\ext\ice directory.

Compilation

  1. Open the command prompt, enter the build directory and set up the build environment variables:
    cd c:\php-sdk\
    phpsdk-vc15-x64.bat
  2. Change directory to the location of your PHP source code and run buildconf.
    cd C:\php-sdk\phpdev\vc15\x64\php-7.2.11-src
    buildconf
  3. Create your configure command and build PHP:
    configure --disable-all --disable-zts --enable-cli --enable-ice=shared
    nmake

Recompile (with Thread Safe option)

Recompile after you have done some changes:

  1. Clean up old compiled binaries, reconfigure and build PHP:
    nmake clean
    buildconf --force
    configure --disable-all --enable-cli --enable-ice=shared
    nmake