static-php-cli/zh/guide/extension-notes.html

24 lines
33 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="zh" dir="ltr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>扩展注意事项 | static-php-cli</title>
<meta name="description" content="Build single static PHP binary, with PHP project together, with popular extensions included.">
<meta name="generator" content="VitePress v1.2.3">
<link rel="preload stylesheet" href="/assets/style.jjC6PDE9.css" as="style">
<script type="module" src="/assets/app.D3H8Y1BO.js"></script>
<link rel="preload" href="/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
<link rel="modulepreload" href="/assets/chunks/framework.gjrnbxUT.js">
<link rel="modulepreload" href="/assets/chunks/theme.5IQMzWyn.js">
<link rel="modulepreload" href="/assets/zh_guide_extension-notes.md.BwAQ8Pky.lean.js">
<script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
<script id="check-mac-os">document.documentElement.classList.toggle("mac",/Mac|iPhone|iPod|iPad/i.test(navigator.platform));</script>
</head>
<body>
<div id="app"><div class="Layout" data-v-5d98c3a5><!--[--><!--]--><!--[--><span tabindex="-1" data-v-0f60ec36></span><a href="#VPContent" class="VPSkipLink visually-hidden" data-v-0f60ec36> Skip to content </a><!--]--><!----><header class="VPNav" data-v-5d98c3a5 data-v-ae24b3ad><div class="VPNavBar has-sidebar top" data-v-ae24b3ad data-v-ccf7ddec><div class="wrapper" data-v-ccf7ddec><div class="container" data-v-ccf7ddec><div class="title" data-v-ccf7ddec><div class="VPNavBarTitle has-sidebar" data-v-ccf7ddec data-v-ab179fa1><a class="title" href="/zh/" data-v-ab179fa1><!--[--><!--]--><!----><span data-v-ab179fa1>static-php-cli</span><!--[--><!--]--></a></div></div><div class="content" data-v-ccf7ddec><div class="content-body" data-v-ccf7ddec><!--[--><!--]--><div class="VPNavBarSearch search" data-v-ccf7ddec><!----></div><nav aria-labelledby="main-nav-aria-label" class="VPNavBarMenu menu" data-v-ccf7ddec data-v-7f418b0f><span id="main-nav-aria-label" class="visually-hidden" data-v-7f418b0f>Main Navigation</span><!--[--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/zh/guide/" tabindex="0" data-v-7f418b0f data-v-9c663999><!--[--><span data-v-9c663999>构建指南</span><!--]--></a><!--]--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/zh/develop/" tabindex="0" data-v-7f418b0f data-v-9c663999><!--[--><span data-v-9c663999>进阶</span><!--]--></a><!--]--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/zh/contributing/" tabindex="0" data-v-7f418b0f data-v-9c663999><!--[--><span data-v-9c663999>贡献</span><!--]--></a><!--]--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/zh/faq/" tabindex="0" data-v-7f418b0f data-v-9c663999><!--[--><span data-v-9c663999>FAQ</span><!--]--></a><!--]--><!--]--></nav><div class="VPFlyout VPNavBarTranslations translations" data-v-ccf7ddec data-v-88af2de4 data-v-b6c34ac9><button type="button" class="button" aria-haspopup="true" aria-expanded="false" aria-label="Change language" data-v-b6c34ac9><span class="text" data-v-b6c34ac9><span class="vpi-languages option-icon" data-v-b6c34ac9></span><!----><span class="vpi-chevron-down text-icon" data-v-b6c34ac9></span></span></button><div class="menu" data-v-b6c34ac9><div class="VPMenu" data-v-b6c34ac9 data-v-e7ea1737><!----><!--[--><!--[--><div class="items" data-v-88af2de4><p class="title" data-v-88af2de4>简体中文</p><!--[--><div class="VPMenuLink" data-v-88af2de4 data-v-43f1e123><a class="VPLink link" href="/en/guide/extension-notes.html" data-v-43f1e123><!--[-->English<!--]--></a></div><!--]--></div><!--]--><!--]--></div></div></div><div class="VPNavBarAppearance appearance" data-v-ccf7ddec data-v-e6aabb21><button class="VPSwitch VPSwitchAppearance" type="button" role="switch" title="Switch to dark theme" aria-checked="false" data-v-e6aabb21 data-v-d1f28634 data-v-1d5665e3><span class="check" data-v-1d5665e3><span class="icon" data-v-1d5665e3><!--[--><span class="vpi-sun sun" data-v-d1f28634></span><span class="vpi-moon moon" data-v-d1f28634></span><!--]--></span></span></button></div><div class="VPSocialLinks VPNavBarSocialLinks social-links" data-v-ccf7ddec data-v-0394ad82 data-v-7bc22406><!--[--><a class="VPSocialLink no-icon" href="https://github.com/crazywhalecc/static-php-cli" aria-label="github" target="_blank" rel="noopener" data-v-7bc22406 data-v-eee4e7cb><span class="vpi-social-github" /></a><!--]--></div><div class="VPFlyout VPNavBarExtra extra" data-v-ccf7ddec data-v-d0bd9dde data-v-b6c34ac9><button type="button" class="button" aria-haspopup="true" aria-expanded="false" aria-label="extra navigation" data-v-b6c34ac9><span class="vpi-more-horizontal icon" data-v-b6c34ac9></span></button><div class="menu" data-v-b6c34ac9><div class="VPMenu" data-v-b6c34ac9 data-v-e7ea1737><!----><!--[--><!--[--><div class="group translations" data-v-d0bd9dde><p class="trans-title" data-v-d0bd9dde>简体中文</p><!--[--><div class="VPMenuLink" data-v-d0bd9dde data-v-43f1e123><a class="VPLink link" href="/en/guide/extension-notes.html" data-v-43f1e123><!--[-->English<!--]--></a></div><!--]--></div><div class="group" data-v-d0bd9dde><div class="item appearance" data-v-d0bd9dde><p class="label" data-v-d0bd9dde>Appearance</p><div class="appearance-action" data-v-d0bd9dde><button class="VPSwitch VPSwitchAppearance" type="button" role="switch" title="Switch to dark theme" aria-checked="false" data-v-d0bd9dde data-v-d1f28634 data-v-1d5665e3><span class="check" data-v-1d5665e3><span class="icon" data-v-1d5665e3><!--[--><span class="vpi-sun sun" data-v-d1f28634></span><span class="vpi-moon moon" data-v-d1f28634></span><!--]--></span></span></button></div></div></div><div class="group" data-v-d0bd9dde><div class="item social-links" data-v-d0bd9dde><div class="VPSocialLinks social-links-list" data-v-d0bd9dde data-v-7bc22406><!--[--><a class="VPSocialLink no-icon" href="https://github.com/crazywhalecc/static-php-cli" aria-label="github" target="_blank" rel="noopener" data-v-7bc22406 data-v-eee4e7cb><span class="vpi-social-github" /></a><!--]--></div></div></div><!--]--><!--]--></div></div></div><!--[--><!--]--><button type="button" class="VPNavBarHamburger hamburger" aria-label="mobile navigation" aria-expanded="false" aria-controls="VPNavScreen" data-v-ccf7ddec data-v-e5dd9c1c><span class="container" data-v-e5dd9c1c><span class="top" data-v-e5dd9c1c></span><span class="middle" data-v-e5dd9c1c></span><span class="bottom" data-v-e5dd9c1c></span></span></button></div></div></div></div><div class="divider" data-v-ccf7ddec><div class="divider-line" data-v-ccf7ddec></div></div></div><!----></header><div class="VPLocalNav has-sidebar empty" data-v-5d98c3a5 data-v-a6f0e41e><div class="container" data-v-a6f0e41e><button class="menu" aria-expanded="false" aria-controls="VPSidebarNav" data-v-a6f0e41e><span class="vpi-align-left menu-icon" data-v-a6f0e41e></span><span class="menu-text" data-v-a6f0e41e>Menu</span></button><div class="VPLocalNavOutlineDropdown" style="--vp-vh:0px;" data-v-a6f0e41e data-v-17a5e62e><button data-v-17a5e62e>Return to top</button><!----></div></div></div><aside class="VPSidebar" data-v-5d98c3a5 data-v-575e6a36><div class="curtain" data-v-575e6a36></div><nav class="nav" id="VPSidebarNav" aria-labelledby="sidebar-aria-label" tabindex="-1" data-v-575e6a36><span class="visually-hidden" id="sidebar-aria-label" data-v-575e6a36> Sidebar Navigation </span><!--[--><!--]--><!--[--><div class="group" data-v-575e6a36><section class="VPSidebarItem level-0 has-active" data-v-575e6a36 data-v-b8d55f3b><div class="item" role="button" tabindex="0" data-v-b8d55f3b><div class="indicator" data-v-b8d55f3b></div><h2 class="text" data-v-b8d55f3b>构建指南</h2><!----></div><div class="items" data-v-b8d55f3b><!--[--><div class="VPSidebarItem level-1 is-link" data-v-b8d55f3b data-v-b8d55f3b><div class="item" data-v-b8d55f3b><div class="indicator" data-v-b8d55f3b></div><a class="VPLink link link" href="/zh/guide/" data-v-b8d55f3b><!--[--><p class="text" data-v-b8d55f3b>指南</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-b8d55f3b data-v-b8d55f3b><div class="item" data-v-b8d55f3b><div class="indicator" data-v-b8d55f3b></div><a class="VPLink link link" href="/zh/guide/manual-build.html" data-v-b8d55f3b><!--[--><p class="text" data-v-b8d55f3b>本地构建</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-b8d55f3b data-v-b8d55f3b><div class="item" data-v-b8d55f3b><div class="indicator" data-v-b8d55f3b></div><a class="VPLink link link" href="/zh/guide/action-build.html" data-v-b8d55f3b><!--[--><p class="text" data-v-b8d55f3b>Actions 构建</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-b8d55f3b data-v-b8d55f3b><div class="item" data-v-b8d55f3b><div class="indicator" data-v-b8d55f3b></div><a class="VPLink link link" href="/zh/guide/extensions.html" data-v-b8d55f3b><!--[--><p class="text" data-v-b8d55f3b>扩展列表</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-b8d55f3b data-v-b8d55f3b><div class="item" data-v-b8d55f3b><div class="indicator" data-v-b8d55f3b></div><a class="VPLink link link" href="/zh/guide/extension-notes.html" data-v-b8d55f3b><!--[--><p class="text" data-v-b8d55f3b>扩展注意事项</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-b8d55f3b data-v-b8d55f3b><div class="item" data-v-b8d55f3b><div class="indicator" data-v-b8d55f3b></div><a class="VPLink link link" href="/zh/guide/cli-generator.html" data-v-b8d55f3b><!--[--><p class="text" data-v-b8d55f3b>编译命令生成器</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-b8d55f3b data-v-b8d55f3b><div class="item" data-v-b8d55f3b><div class="indicator" data-v-b8d55f3b></div><a class="VPLink link link" href="/zh/guide/env-vars.html" data-v-b8d55f3b><!--[--><p class="text" data-v-b8d55f3b>环境变量列表</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-b8d55f3b data-v-b8d55f3b><div class="item" data-v-b8d55f3b><div class="indicator" data-v-b8d55f3b></div><a class="VPLink link link" href="/zh/guide/deps-map.html" data-v-b8d55f3b><!--[--><p class="text" data-v-b8d55f3b>依赖关系图表</p><!--]--></a><!----></div><!----></div><!--]--></div></section></div><div class="group" data-v-575e6a36><section class="VPSidebarItem level-0" data-v-575e6a36 data-v-b8d55f3b><div class="item" role="button" tabindex="0" data-v-b8d55f3b><div class="indicator" data-v-b8d55f3b></div><h2 class="text" data-v-b8d55f3b>扩展构建指南</h2><!----></div><div class="items" data-v-b8d55f3b><!--[--><div class="VPSidebarItem level-1 is-link" data-v-b8d55f3b data-v-b8d55f3b><div class="item" data-v-b8d55f3b><div class="indicator" data-v-b8d55f3b></div><a class="VPLink link link" href="/zh/guide/troubleshooting.html" data-v-b8d55f3b><!--[--><p class="text" data-v-b8d55f3b>故障排除</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-b8d55f3b data-v-b8d55f3b><div class="item" data-v-b8d55f3b><div class="indicator" data-v-b8d55f3b></div><a class="VPLink link link" href="/zh/guide/build-on-windows.html" data-v-b8d55f3b><!--[--><p class="text" data-v-b8d55f3b>在 Windows 上构建</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-b8d55f3b data-v-b8d55f3b><div class="item" data-v-b8d55f3b><div class="indicator" data-v-b8d55f3b></div><a class="VPLink link link" href="/zh/guide/build-with-glibc.html" data-v-b8d55f3b><!--[--><p class="text" data-v-b8d55f3b>构建 GNU libc 兼容的二进制</p><!--]--></a><!----></div><!----></div><!--]--></div></section></div><!--]--><!--[--><!--]--></nav></aside><div class="VPContent has-sidebar" id="VPContent" data-v-5d98c3a5 data-v-1428d186><div class="VPDoc has-sidebar has-aside" data-v-1428d186 data-v-39a288b8><!--[--><!--]--><div class="container" data-v-39a288b8><div class="aside" data-v-39a288b8><div class="aside-curtain" data-v-39a288b8></div><div class="aside-container" data-v-39a288b8><div class="aside-content" data-v-39a288b8><div class="VPDocAside" data-v-39a288b8 data-v-3f215769><!--[--><!--]--><!--[--><!--]--><nav aria-labelledby="doc-outline-aria-label" class="VPDocAsideOutline" data-v-3f215769 data-v-a5bbad30><div class="content" data-v-a5bbad30><div class="outline-marker" data-v-a5bbad30></div><div aria-level="2" class="outline-title" id="doc-outline-aria-label" role="heading" data-v-a5bbad30>On this page</div><ul class="VPDocOutlineItem root" data-v-a5bbad30 data-v-b933a997><!--[--><!--]--></ul></div></nav><!--[--><!--]--><div class="spacer" data-v-3f215769></div><!--[--><!--]--><!----><!--[--><!--]--><!--[--><!--]--></div></div></div></div><div class="content" data-v-39a288b8><div class="content-container" data-v-39a288b8><!--[--><!--]--><main class="main" data-v-39a288b8><div style="position:relative;" class="vp-doc _zh_guide_extension-notes" data-v-39a288b8><div><h1 id="扩展注意事项" tabindex="-1">扩展注意事项 <a class="header-anchor" href="#扩展注意事项" aria-label="Permalink to &quot;扩展注意事项&quot;"></a></h1><p>因为是静态编译,扩展不会 100% 完美编译,而且不同扩展对 PHP、环境都有不同的要求这里将一一列举。</p><h2 id="curl" tabindex="-1">curl <a class="header-anchor" href="#curl" aria-label="Permalink to &quot;curl&quot;"></a></h2><p>HTTP3 支持默认未启用,需在编译时添加 <code>--with-libs=&quot;nghttp2,nghttp3,ngtcp2&quot;</code> 以启用 PHP 8.4 及以上版本的 HTTP3 支持。</p><p>使用 curl 请求 HTTPS 时,可能存在 <code>error:80000002:system library::No such file or directory</code> 错误, 解决办法详见 <a href="./../faq/#无法使用-ssl">FAQ - 无法使用 ssl</a></p><h2 id="phpmicro" tabindex="-1">phpmicro <a class="header-anchor" href="#phpmicro" aria-label="Permalink to &quot;phpmicro&quot;"></a></h2><ol><li>phpmicro SAPI 仅支持 PHP &gt;= 8.0 版本。</li></ol><h2 id="swoole" tabindex="-1">swoole <a class="header-anchor" href="#swoole" aria-label="Permalink to &quot;swoole&quot;"></a></h2><ol><li>swoole &gt;= 5.0 版本仅支持 PHP &gt;= 8.0 版本。</li><li>swoole 目前不支持 PHP 8.0 版本 curl 的 hook后续有可能会修复</li><li>编译时只包含 <code>swoole</code> 扩展时不会完整开启支持的 Swoole 数据库协程 hook如需使用请加入对应的 <code>swoole-hook-xxx</code> 扩展。</li><li>swoole 在部分扩展组合下可能出现 <code>zend_mm_heap corrupted</code> 问题,暂未找到是什么原因导致的。</li></ol><h2 id="swoole-hook-pgsql" tabindex="-1">swoole-hook-pgsql <a class="header-anchor" href="#swoole-hook-pgsql" aria-label="Permalink to &quot;swoole-hook-pgsql&quot;"></a></h2><p>swoole-hook-pgsql 不是一个扩展,而是 Swoole 的 Hook 特性。 如果你在编译时添加了 <code>swoole,swoole-hook-pgsql</code>,你将启用 Swoole 的 PostgreSQL 客户端和 <code>pdo_pgsql</code> 扩展的协程模式。</p><p>swoole-hook-pgsql 与 <code>pdo_pgsql</code> 扩展冲突。如需使用 Swoole 和 <code>pdo_pgsql</code>,请删除 pdo_pgsql 扩展,启用 <code>swoole</code><code>swoole-hook-pgsql</code> 即可。 该扩展包含了 <code>pdo_pgsql</code> 的协程环境的实现。</p><p>在 macOS 系统,<code>pdo_pgsql</code> 可能无法正常连接到 postgresql 服务器,请谨慎使用。</p><h2 id="swoole-hook-mysql" tabindex="-1">swoole-hook-mysql <a class="header-anchor" href="#swoole-hook-mysql" aria-label="Permalink to &quot;swoole-hook-mysql&quot;"></a></h2><p>swoole-hook-mysql 不是一个扩展,而是 Swoole 的 Hook 特性。 如果你在编译时添加了 <code>swoole,swoole-hook-mysql</code>,你将启用 Swoole 的 <code>mysqlnd</code><code>pdo_mysql</code> 的协程模式。</p><h2 id="swoole-hook-sqlite" tabindex="-1">swoole-hook-sqlite <a class="header-anchor" href="#swoole-hook-sqlite" aria-label="Permalink to &quot;swoole-hook-sqlite&quot;"></a></h2><p>swoole-hook-sqlite 不是一个扩展,而是 Swoole 的 Hook 特性。 如果你在编译时添加了 <code>swoole,swoole-hook-sqlite</code>,你将启用 Swoole 的 <code>pdo_sqlite</code> 的协程模式Swoole 必须为 5.1 以上)。</p><p>swoole-hook-sqlite 与 <code>pdo_sqlite</code> 扩展冲突。如需使用 Swoole 和 <code>pdo_sqlite</code>,请删除 pdo_sqlite 扩展,启用 <code>swoole</code><code>swoole-hook-sqlite</code> 即可。 该扩展包含了 <code>pdo_sqlite</code> 的协程环境的实现。</p><h2 id="swow" tabindex="-1">swow <a class="header-anchor" href="#swow" aria-label="Permalink to &quot;swow&quot;"></a></h2><ol><li>swow 仅支持 PHP 8.0 ~ 8.4 版本。</li></ol><h2 id="imagick" tabindex="-1">imagick <a class="header-anchor" href="#imagick" aria-label="Permalink to &quot;imagick&quot;"></a></h2><p>imagick 扩展目前仅在 musl libc 上支持 OpenMPlibgomp。使用 glibc 方式构建的 imagick 扩展无法支持多线程特性。</p><h2 id="imap" tabindex="-1">imap <a class="header-anchor" href="#imap" aria-label="Permalink to &quot;imap&quot;"></a></h2><ol><li>该扩展目前不支持 Kerberos。</li><li>由于底层的 c-client、ext-imap 不是线程安全的。 无法在 <code>--enable-zts</code> 构建中使用它。</li><li>由于该扩展可能会从未来的 PHP 中删除,因此我们建议您寻找替代实现,例如 <a href="https://github.com/Webklex/php-imap" target="_blank" rel="noreferrer">Webklex/php-imap</a></li></ol><h2 id="gd" tabindex="-1">gd <a class="header-anchor" href="#gd" aria-label="Permalink to &quot;gd&quot;"></a></h2><ol><li>gd 扩展依赖了较多的额外图形库,默认情况下,直接使用 <code>bin/spc build gd</code> 不会引入和支持部分图形库,例如 <code>libjpeg</code><code>libavif</code> 等, 需要使用 <code>--with-libs</code> 参数补全。目前支持 <code>freetype,libjpeg,libavif,libwebp</code> 四个库的支持,所以这里可以使用以下命令来让 gd 库引入它们:</li></ol><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">bin/spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> build</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> gd</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --with-libs=freetype,libjpeg,libavif,libwebp</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --build-cli</span></span></code></pre></div><h2 id="mcrypt" tabindex="-1">mcrypt <a class="header-anchor" href="#mcrypt" aria-label="Permalink to &quot;mcrypt&quot;"></a></h2><ol><li>目前未支持,未来也不计划支持此扩展。<a href="https://github.com/crazywhalecc/static-php-cli/issues/32" target="_blank" rel="noreferrer">#32</a></li></ol><h2 id="oci8" tabindex="-1">oci8 <a class="header-anchor" href="#oci8" aria-label="Permalink to &quot;oci8&quot;"></a></h2><ol><li>oci8 是 Oracle 数据库的扩展,因为 Oracle 提供的扩展所依赖的库未提供静态编译版本(<code>.a</code>)或源代码,无法使用静态链接的方式将此扩展编译到 php 内,故无法支持。</li></ol><h2 id="xdebug" tabindex="-1">xdebug <a class="header-anchor" href="#xdebug" aria-label="Permalink to &quot;xdebug&quot;"></a></h2><ol><li>Xdebug 只能作为共享扩展进行构建。在 Linux 上,您需要使用 static-php-cli 并设置 SPC_LIBC=glibc。</li><li>使用 Linux/glibc 或 macOS 时,您可以使用 <code>--build-shared=xdebug</code> 将 Xdebug 编译为共享扩展。 编译后的 <code>./php</code> 二进制文件可以通过指定 INI 文件进行配置和运行,例如 <code>./php -d &#39;zend_extension=/path/to/xdebug.so&#39; your-code.php</code></li></ol><h2 id="xml" tabindex="-1">xml <a class="header-anchor" href="#xml" aria-label="Permalink to &quot;xml&quot;"></a></h2><ol><li>xml包括 xmlreader、xmlwriter、dom、simplexml 等,添加 xml 扩展时最好同时启用这些扩展。</li><li>libxml 包含在 xml 扩展中。 启用 xml 相当于启用 libxml。</li></ol><h2 id="glfw" tabindex="-1">glfw <a class="header-anchor" href="#glfw" aria-label="Permalink to &quot;glfw&quot;"></a></h2><ol><li>glfw 扩展依赖 OpenGL在 Linux 平台还依赖 X11 等环境,这些库都无法被轻易地动态链接。</li><li>在 macOS 系统下,我们可以动态链接系统的 OpenGL 和一些相关的库。</li></ol><h2 id="rar" tabindex="-1">rar <a class="header-anchor" href="#rar" aria-label="Permalink to &quot;rar&quot;"></a></h2><ol><li>rar 扩展目前在 macOS x86_64 环境下与 <code>common</code> 扩展集合编译 phpmicro 存在问题。</li></ol><h2 id="pgsql" tabindex="-1">pgsql <a class="header-anchor" href="#pgsql" aria-label="Permalink to &quot;pgsql&quot;"></a></h2><p><s>pgsql ssl 连接与 openssl 3.2.0 不兼容。相关链接:</s></p><ul><li><s><a href="https://github.com/Homebrew/homebrew-core/issues/155651" target="_blank" rel="noreferrer">https://github.com/Homebrew/homebrew-core/issues/155651</a></s></li><li><s><a href="https://github.com/Homebrew/homebrew-core/pull/155699" target="_blank" rel="noreferrer">https://github.com/Homebrew/homebrew-core/pull/155699</a></s></li><li><s><a href="https://github.com/postgres/postgres/commit/c82207a548db47623a2bfa2447babdaa630302b9" target="_blank" rel="noreferrer">https://github.com/postgres/postgres/commit/c82207a548db47623a2bfa2447babdaa630302b9</a></s></li></ul><p>pgsql 16.2 修复了这个 Bug现在正常工作了。</p><p>在 pgsql 使用 SSL 连接时,可能存在 <code>error:80000002:system library::No such file or directory</code> 错误, 解决办法详见 <a href="./../faq/#无法使用-ssl">FAQ - 无法使用 ssl</a></p><h2 id="openssl" tabindex="-1">openssl <a class="header-anchor" href="#openssl" aria-label="Permalink to &quot;openssl&quot;"></a></h2><p>使用基于 openssl 的扩展(如 curl、pgsql 等网络库)时,可能存在 <code>error:80000002:system library::No such file or directory</code> 错误, 解决办法详见 <a href="./../faq/#无法使用-ssl">FAQ - 无法使用 ssl</a></p><h2 id="password-argon2" tabindex="-1">password-argon2 <a class="header-anchor" href="#password-argon2" aria-label="Permalink to &quot;password-argon2&quot;"></a></h2><ol><li>password-argon2不是一个标准的扩展它是 <code>password_hash</code> 函数的额外算法。</li><li>在Linux系统password-argon2 的依赖库 <code>libargon2</code><code>libsodium</code> 库冲突。</li></ol><h2 id="ffi" tabindex="-1">ffi <a class="header-anchor" href="#ffi" aria-label="Permalink to &quot;ffi&quot;"></a></h2><ol><li>由于 musl libc 静态链接的限制,无法加载动态库,因此无法使用 ffi。 如果您需要使用 ffi 扩展,请参阅 <a href="./build-with-glibc.html">使用 GNU libc 编译 PHP</a></li><li>macOS 支持 ffi 扩展,但某些内核不包含调试符号时会出现错误。</li><li>Windows x64 支持 ffi 扩展。</li></ol><h2 id="xhprof" tabindex="-1">xhprof <a class="header-anchor" href="#xhprof" aria-label="Permalink to &quot;xhprof&quot;"></a></h2><p>xhprof 扩展包含三部分:<code>xhprof_extension</code><code>xhprof_html</code><code>xhprof_libs</code>。编译的二进制中只包含 <code>xhprof_extension</code>。 如果需要使用 xhprof请到 <a href="http://pecl.php.net/package/xhprof" target="_blank" rel="noreferrer">pecl.php.net/package/xhprof</a> 下载源码,指定 <code>xhprof_libs</code><code>xhprof_html</code> 路径来使用。</p><h2 id="event" tabindex="-1">event <a class="header-anchor" href="#event" aria-label="Permalink to &quot;event&quot;"></a></h2><p>event 扩展在 macOS 系统下编译后暂无法使用 <code>openpty</code> 特性。相关 Issue</p><ul><li><a href="https://github.com/crazywhalecc/static-php-cli/issues/335" target="_blank" rel="noreferrer">static-php-cli#335</a></li></ul><h2 id="parallel" tabindex="-1">parallel <a class="header-anchor" href="#parallel" aria-label="Permalink to &quot;parallel&quot;"></a></h2><p>parallel 扩展只支持 PHP 8.0 及以上版本,并只支持 ZTS 构建(<code>--enable-zts</code>)。</p><h2 id="spx" tabindex="-1">spx <a class="header-anchor" href="#spx" aria-label="Permalink to &quot;spx&quot;"></a></h2><ol><li><a href="https://github.com/NoiseByNorthwest/php-spx" target="_blank" rel="noreferrer">SPX 扩展</a> 只支持非线程模式。</li><li>SPX 目前不支持 Windows且官方仓库也不支持静态编译static-php-cli 使用了 <a href="https://github.com/static-php/php-spx" target="_blank" rel="noreferrer">修改版本</a></li></ol><h2 id="mimalloc" tabindex="-1">mimalloc <a class="header-anchor" href="#mimalloc" aria-label="Permalink to &quot;mimalloc&quot;"></a></h2><ol><li>从技术上讲,这不是扩展,而是一个库。</li><li>在 Linux 或 macOS 上使用 <code>--with-libs=&quot;mimalloc&quot;</code> 进行构建将覆盖默认分配器。</li><li>目前,这还处于实验阶段,但建议在线程环境中使用。</li></ol></div></div></main><footer class="VPDocFooter" data-v-39a288b8 data-v-d4a0bba5><!--[--><!--]--><!----><nav class="prev-next" aria-labelledby="doc-footer-aria-label" data-v-d4a0bba5><span class="visually-hidden" id="doc-footer-aria-label" data-v-d4a0bba5>Pager</span><div class="pager" data-v-d4a0bba5><a class="VPLink link pager-link prev" href="/zh/guide/extensions.html" data-v-d4a0bba5><!--[--><span class="desc" data-v-d4a0bba5>Previous page</span><span class="title" data-v-d4a0bba5>扩展列表</span><!--]--></a></div><div class="pager" data-v-d4a0bba5><a class="VPLink link pager-link next" href="/zh/guide/cli-generator.html" data-v-d4a0bba5><!--[--><span class="desc" data-v-d4a0bba5>Next page</span><span class="title" data-v-d4a0bba5>编译命令生成器</span><!--]--></a></div></nav></footer><!--[--><!--]--></div></div></div><!--[--><!--]--></div></div><footer class="VPFooter has-sidebar" data-v-5d98c3a5 data-v-e315a0ad><div class="container" data-v-e315a0ad><p class="message" data-v-e315a0ad>Released under the MIT License.</p><p class="copyright" data-v-e315a0ad>Copyright © 2023-present crazywhalecc</p></div></footer><!--[--><!--]--></div></div>
<script>window.__VP_HASH_MAP__=JSON.parse("{\"zh_develop_php-src-changes.md\":\"Df0-NcBw\",\"deps-craft-yml.md\":\"DdOLH9fb\",\"en_contributing_index.md\":\"CsY8mx8F\",\"en_develop_index.md\":\"B7_c9YYa\",\"en_develop_php-src-changes.md\":\"DLlooohw\",\"zh_guide_extensions.md\":\"HviYRhA7\",\"zh_develop_structure.md\":\"B-0RMSSw\",\"zh_develop_system-build-tools.md\":\"Ds53VEw1\",\"zh_guide_action-build.md\":\"DWMlBDvT\",\"zh_develop_source-module.md\":\"D0odLsHX\",\"zh_faq_index.md\":\"CGJwisr-\",\"zh_guide_build-on-windows.md\":\"BxVEYT8r\",\"index.md\":\"mKXtywCA\",\"zh_guide_env-vars.md\":\"C-N0X5FV\",\"zh_index.md\":\"LslJ1UMp\",\"zh_guide_index.md\":\"20ged7P4\",\"zh_guide_troubleshooting.md\":\"DAr4n5J3\",\"zh_contributing_index.md\":\"BvgdahxO\",\"zh_develop_craft-yml.md\":\"Crgeurk7\",\"en_guide_index.md\":\"BScdGPaV\",\"en_faq_index.md\":\"Dk3Q4ZlV\",\"en_develop_system-build-tools.md\":\"D6vaAwN3\",\"en_develop_doctor-module.md\":\"DGd8PeM_\",\"en_guide_build-with-glibc.md\":\"CR2nDLf8\",\"en_guide_extension-notes.md\":\"D_szqpv1\",\"en_guide_extensions.md\":\"CvNq1b9J\",\"deps-map-ext.md\":\"CKpfVu5J\",\"en_guide_cli-generator.md\":\"BVb63i-q\",\"en_guide_build-on-windows.md\":\"0XosmiyO\",\"en_guide_env-vars.md\":\"CMHjddfB\",\"zh_guide_build-with-glibc.md\":\"6Wr3xgOs\",\"en_guide_action-build.md\":\"BKamBazh\",\"deps-map-lib.md\":\"D13FvK2Q\",\"zh_guide_deps-map.md\":\"DuTyzThf\",\"en_index.md\":\"Cbpb4iAg\",\"en_guide_troubleshooting.md\":\"CTxnPJxK\",\"extension-notes.md\":\"Bw8xYOie\",\"zh_guide_cli-generator.md\":\"BQovOB62\",\"extensions.md\":\"B7vVUihc\",\"en_develop_structure.md\":\"BA5PDIse\",\"zh_guide_manual-build.md\":\"Rx1xsyX8\",\"zh_guide_extension-notes.md\":\"BwAQ8Pky\",\"en_guide_deps-map.md\":\"C7t3AggN\",\"en_develop_source-module.md\":\"CdOHR0ez\",\"zh_develop_doctor-module.md\":\"DgFAPT6E\",\"zh_develop_index.md\":\"-CPpDfMx\",\"en_develop_craft-yml.md\":\"B3k-Nl-b\",\"en_guide_manual-build.md\":\"BU7HLqGh\"}");window.__VP_SITE_DATA__=JSON.parse("{\"lang\":\"en-US\",\"dir\":\"ltr\",\"title\":\"static-php-cli\",\"description\":\"Build single static PHP binary, with PHP project together, with popular extensions included.\",\"base\":\"/\",\"head\":[],\"router\":{\"prefetchLinks\":true},\"appearance\":true,\"themeConfig\":{\"nav\":[],\"socialLinks\":[{\"icon\":\"github\",\"link\":\"https://github.com/crazywhalecc/static-php-cli\"}]},\"locales\":{\"en\":{\"label\":\"English\",\"lang\":\"en\",\"themeConfig\":{\"nav\":[{\"text\":\"Guide\",\"link\":\"/en/guide/\"},{\"text\":\"Advanced\",\"link\":\"/en/develop/\"},{\"text\":\"Contributing\",\"link\":\"/en/contributing/\"},{\"text\":\"FAQ\",\"link\":\"/en/faq/\"}],\"sidebar\":{\"/en/guide/\":[{\"text\":\"Basic Build Guides\",\"items\":[{\"text\":\"Guide\",\"link\":\"/en/guide/\"},{\"text\":\"Build (Local)\",\"link\":\"/en/guide/manual-build\"},{\"text\":\"Build (CI)\",\"link\":\"/en/guide/action-build\"},{\"text\":\"Supported Extensions\",\"link\":\"/en/guide/extensions\"},{\"text\":\"Extension Notes\",\"link\":\"/en/guide/extension-notes\"},{\"text\":\"Build Command Generator\",\"link\":\"/en/guide/cli-generator\"},{\"text\":\"Environment Variables\",\"link\":\"/en/guide/env-vars\",\"collapsed\":true},{\"text\":\"Dependency Table\",\"link\":\"/en/guide/deps-map\"}]},{\"text\":\"Extended Build Guides\",\"items\":[{\"text\":\"Troubleshooting\",\"link\":\"/en/guide/troubleshooting\"},{\"text\":\"Build on Windows\",\"link\":\"/en/guide/build-on-windows\"},{\"text\":\"Build with GNU libc\",\"link\":\"/en/guide/build-with-glibc\"}]}],\"/en/develop/\":[{\"text\":\"Development\",\"items\":[{\"text\":\"Get Started\",\"link\":\"/en/develop/\"},{\"text\":\"Project Structure\",\"link\":\"/en/develop/structure\"},{\"text\":\"PHP Source Modification\",\"link\":\"/en/develop/php-src-changes\"}]},{\"text\":\"Module\",\"items\":[{\"text\":\"Doctor \",\"link\":\"/en/develop/doctor-module\"},{\"text\":\"Source\",\"link\":\"/en/develop/source-module\"}]},{\"text\":\"Extra\",\"items\":[{\"text\":\"Compilation Tools\",\"link\":\"/en/develop/system-build-tools\"},{\"text\":\"craft.yml Configuration\",\"link\":\"/zh/develop/craft-yml\"}]}],\"/en/contributing/\":[{\"text\":\"Contributing\",\"items\":[{\"text\":\"Contributing\",\"link\":\"/en/contributing/\"}]}]},\"footer\":{\"message\":\"Released under the MIT License.\",\"copyright\":\"Copyright © 2023-present crazywhalecc\"}}},\"zh\":{\"label\":\"简体中文\",\"lang\":\"zh\",\"themeConfig\":{\"nav\":[{\"text\":\"构建指南\",\"link\":\"/zh/guide/\"},{\"text\":\"进阶\",\"link\":\"/zh/develop/\"},{\"text\":\"贡献\",\"link\":\"/zh/contributing/\"},{\"text\":\"FAQ\",\"link\":\"/zh/faq/\"}],\"sidebar\":{\"/zh/guide/\":[{\"text\":\"构建指南\",\"items\":[{\"text\":\"指南\",\"link\":\"/zh/guide/\"},{\"text\":\"本地构建\",\"link\":\"/zh/guide/manual-build\"},{\"text\":\"Actions 构建\",\"link\":\"/zh/guide/action-build\"},{\"text\":\"扩展列表\",\"link\":\"/zh/guide/extensions\"},{\"text\":\"扩展注意事项\",\"link\":\"/zh/guide/extension-notes\"},{\"text\":\"编译命令生成器\",\"link\":\"/zh/guide/cli-generator\"},{\"text\":\"环境变量列表\",\"link\":\"/zh/guide/env-vars\"},{\"text\":\"依赖关系图表\",\"link\":\"/zh/guide/deps-map\"}]},{\"text\":\"扩展构建指南\",\"items\":[{\"text\":\"故障排除\",\"link\":\"/zh/guide/troubleshooting\"},{\"text\":\"在 Windows 上构建\",\"link\":\"/zh/guide/build-on-windows\"},{\"text\":\"构建 GNU libc 兼容的二进制\",\"link\":\"/zh/guide/build-with-glibc\"}]}],\"/zh/develop/\":[{\"text\":\"开发指南\",\"items\":[{\"text\":\"开发简介\",\"link\":\"/zh/develop/\"},{\"text\":\"项目结构简介\",\"link\":\"/zh/develop/structure\"},{\"text\":\"对 PHP 源码的修改\",\"link\":\"/zh/develop/php-src-changes\"}]},{\"text\":\"模块\",\"items\":[{\"text\":\"Doctor 环境检查工具\",\"link\":\"/zh/develop/doctor-module\"},{\"text\":\"资源模块\",\"link\":\"/zh/develop/source-module\"}]},{\"text\":\"其他\",\"items\":[{\"text\":\"系统编译工具\",\"link\":\"/zh/develop/system-build-tools\"},{\"text\":\"craft.yml 配置详解\",\"link\":\"/zh/develop/craft-yml\"}]}],\"/zh/contributing/\":[{\"text\":\"贡献指南\",\"items\":[{\"text\":\"贡献指南\",\"link\":\"/zh/contributing/\"}]}]},\"footer\":{\"message\":\"Released under the MIT License.\",\"copyright\":\"Copyright © 2023-present crazywhalecc\"}}}},\"scrollOffset\":134,\"cleanUrls\":false}");</script>
</body>
</html>