如何用快照构建扩展名编译PHP嵌入SAPI静态编译
试图编译Windows嵌入的SAPI PHP二进制文件的问题
,其中包括Core PHP和快照扩展名,其中有尽可能多的静态链接。
尝试使用PHP 7.4,ZTS,X64 VC15(Visual Studio 2017)
尝试(使用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
上述命令为我提供了许多战争,如下所示:
- 未知选项ldflags;请尝试使用configure.js-可用于有效选项未知选项的列表
- - 可启用静态;请尝试使用configure.js-对于有效选项列表的螺旋,
- 以下参数无效,因此被忽略: - 共享 - 启用静止的
笔记,
- 我知道某些扩展名无法静态编译,即com_dotnet等,
- 在类似问题上提供的命令上尝试了变体:将php编译成静态二进制 (这个问题非常特定于损坏的安装(与libxml2有关),我建议不要将其标记为此的重复),
- 我看到了
的引用 - 启用了Google的
似乎不是一个有效的论点。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最终以以下命令:
导致以下构建:
Ended up with the following command:
Which resulted in the following build: