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
- Get the Visual C++ 15.0 compiler, it's in Visual Studio 2017 Community.
- Get the PHP source from Stable releases (click the Download source code).
- Get the latest binary tools from php-sdk-binary-tools.
- 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.
- Create the build directory
c:\php-sdk
. - Unpack the binary tools archive into this directory.
- Open the command prompt, enter the build directory and invoke the starter script:
cd c:\php-sdk\ phpsdk-vc15-x64.bat
- 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
toC:\php-sdk\phpdev\vc15
.
- The buildtree script hasn't been updated for newer versions of VC++, so copy
- 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. - 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
- Extract Ice source code, copy & rename the
build\php7\
directory toC:\php-sdk\phpdev\vc15\x64\php-7.2.11-src\ext\ice
directory.
Compilation
- Open the command prompt, enter the build directory and set up the build environment variables:
cd c:\php-sdk\ phpsdk-vc15-x64.bat
- 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
- Create your configure command and build PHP:
configure --disable-all --disable-zts --enable-cli --enable-ice=shared nmake
- The php_ice.dll file is now under
C:\php-sdk\phpdev\vc15\x64\php-7.2.11-src\x64\Release
. If you compiled without --disable-zts the php_ice.dll file will be underC:\php-sdk\phpdev\vc15\x64\php-7.2.11-src\x64\Release_TS
.
Recompile (with Thread Safe option)
Recompile after you have done some changes:
- Clean up old compiled binaries, reconfigure and build PHP:
nmake clean buildconf --force configure --disable-all --enable-cli --enable-ice=shared nmake