The problem
Trying to compile a Windows Embed SAPI PHP binary that includes the core PHP and snapshot extensions, with as many of them as possible statically linked.
Trying with PHP 7.4, ZTS, x64 VC15 (Visual Studio 2017)
What I’ve tried (using Appveyor)
configure.bat --!ZTS_STATE!-zts --enable-object-out-dir=%PHP_BUILD_OBJ_DIR% --with-config-file-scan-dir=%APPVEYOR_BUILD_FOLDER%\build\modules.d --with-prefix=%APPVEYOR_BUILD_FOLDER%\build --with-php-build=%DEPS_DIR% --enable-embed --enable-cli-win32 --enable-snapshot-build --enable-debug-pack --enable-com-dotnet=shared --without-analyzer --disable-phpdbg-webhelper --disable-cgi LDFLAGS=-static
configure.bat --!ZTS_STATE!-zts --enable-object-out-dir=%PHP_BUILD_OBJ_DIR% --with-config-file-scan-dir=%APPVEYOR_BUILD_FOLDER%\build\modules.d --with-prefix=%APPVEYOR_BUILD_FOLDER%\build --with-php-build=%DEPS_DIR% --enable-embed --enable-cli-win32 --enable-snapshot-build --enable-debug-pack --enable-com-dotnet=shared --without-analyzer --disable-phpdbg-webhelper --disable-cgi --enable-static=yes
configure.bat --!ZTS_STATE!-zts --enable-object-out-dir=%PHP_BUILD_OBJ_DIR% --with-config-file-scan-dir=%APPVEYOR_BUILD_FOLDER%\build\modules.d --with-prefix=%APPVEYOR_BUILD_FOLDER%\build --with-php-build=%DEPS_DIR% --enable-embed --enable-cli-win32 --enable-snapshot-build --enable-debug-pack --enable-com-dotnet=shared --without-analyzer --disable-phpdbg-webhelper --disable-cgi --enable-shared=no --enable-static=yes
The above commands give me a number of warinings as per below:
- Unknown option LDFLAGS; please try configure.js --help for a list of valid options
- Unknown option --enable-static; please try configure.js --help for a list of valid options
- The following arguments is invalid, and therefore ignored: --enable-shared --enable-static
Notes
- I am aware some extensions can not be statically compiled i.e com_dotnet etc
- Tried variations on the commands provided on the similar question: Compile PHP into Static Binary (This question is very specific to a broken install (relating to libxml2) and I would suggest not be marked as a duplicate of this one)
- I see references to
--enable-static
all over google but it doesnt seem to be a valid argument.