This guide is added for packagers or developers of the igbinary project.
Downloading prebuilt DLLs from PECL is easier for end users.
If you don't have Windows installed:
- Download a VM from https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/ (E.g. Windows 7 IE11) Prefer Windows 7. The trial period can be extended.
- Install the VM. Keep the disk image around, the VM trial period expires in 30 days.
- (Optional) Configure the VM to use more than one core (but not all available cores) to speed up installation/upgrading/compiling.
- Download https://support.microsoft.com/en-us/kb/3102810#bookmark-prerequisite (x86), disable internet, install that patch, re-enable internet)
- Run Windows Updates, which will take a long time.
- Read the instructions on the desktop background (for extending trial period).
- (Windows 7)Search for "Command Prompt", right click on it and click "Run as administrator", and execute
slmgr /atoto extend the trial period to 90 days.
If the license expires/is about to expire, it is possible to "re-arm" (extend) the license several times with slmgr
-
Download the version of Visual Studio needed to build the desired version of PHP (mentioned on https://wiki.php.net/internals/windows/stepbystepbuild#building_pecl_extensions for PHP 7.0-7.1), and https://wiki.php.net/internals/windows/stepbystepbuild_sdk_2 for PHP 7.2+
At the time of writing, that was Visual Studio Community Edition 2015 for PHP7.0 - 7.2, and Visual Studio Community Edition 2017 for PHP 7.2+
-
Install Visual Studio 2015. (Use custom installation, make sure that all C++ features are enabled)
See https://wiki.php.net/internals/windows/stepbystepbuild
Prefer downloading stable releases of php?
(This hasn't been tested yet on the suggested VM)
See https://wiki.php.net/internals/windows/stepbystepbuild#building\_pecl\_extensions
Note: The Windows build hasn't worked for a while in 5.6, so there may be compilation errors or test failures.
TODO: Make sure that config.w32 works without APCu installed.
Open the extension's page on PECL (APCu)
Download the extension source either by:
- downloading a source archive
- fetching the source from the extension's repository (link can be found under Browse Source)
Create a directory named pecl on the same level as your PHP source directory, e.g. C:\php-sdk\phpdev\vc11\x86\pecl
Extract or clone the extension source code to the pecl directory
- if cloning, clone to a subdirectory, e.g. C:\php-sdk\phpdev\vc11\x86\pecl\apcu
- source code archive should already contain a subdirectory named e.g. apcu-4.0.7
Open a command prompt, run the
setvarsscript, and enter your PHP source directoryRebuild the configure script by running:
buildconfExecuting
configure --helpshould now contain an option to enable APCu--enable-apcu Whether to enable APCu supportConfigure and build:
configure --disable-all --enable-cli --enable-apcunmakeTest the binary with a php -m command, to make sure APCu is loaded
Similar to the above instructions.
-
(This isn't released yet, skip this step and download from github) Open the extension's page on PECL ( APCu)
-
Download the extension source either by:
- downloading a source archive
- fetching the source from the extension's repository (link can be found under Browse Source) https://github.com/igbinary/igbinary/
-
If it doesn't already exist, then create a directory named pecl on the same level as your PHP source directory, e.g. C:\php-sdk\phpdev\vc11\x86\pecl
-
Extract or clone the extension source code to the pecl directory
- if cloning, clone to a subdirectory, e.g. C:\php-sdk\phpdev\vc11\x86\pecl\igbinary
- source code archive should already contain a subdirectory with a name like igbinary-2.0.8. That should be renamed to igbinary.
-
Open a command prompt, run the setvars script, and enter your PHP source directory (not the extension directory)
-
Rebuild the configure script by running:
buildconf -
Executing
configure --helpshould now contain options. (config.m4currently has no options. May allow disabling apcu support in the future, etc.)--enable-apcu Whether to enable APCu support --enable-igbinary Whether to enable igbinary support -
Configure and build: One may want to set CFLAGS (or equivalent) to -O2 so it will be faster?
If you want to test sessions and apcu as well, an extremely minimal configure script would be:
configure --disable-all --enable-cli --enable-cgi --enable-apcu --enable-igbinary --enable-json(If testing a full installation, add
--enable-igbinaryto the config flags you were already using)Then, build/rebuild php.
nmake -
Invoke the
php -mcommand to confirm that igbinary is loaded. (and any other extensions such as APCu) -
Run the unit tests. Most should pass, some should be skipped (Or be expected failures(XFAIL)), none should fail.
# In the php source directory, execute the following commands: nmake test TESTS=C:\php-sdk\phpdev\path\to\igbinary\tests # Optional test of related extensions: # nmake test TESTS=C:\php-sdk\phpdev\path\to\apcu\testsIn recent releases of php7, this can be probably done by running
nmake testwithin the igbinary folder immediately after configuration for the desired php7 version.