{"id":1430,"date":"2022-06-02T15:49:28","date_gmt":"2022-06-02T07:49:28","guid":{"rendered":"https:\/\/www.yeetrack.com\/?p=1430"},"modified":"2022-06-02T15:55:14","modified_gmt":"2022-06-02T07:55:14","slug":"%e7%bc%96%e8%af%91%e5%ae%89%e8%a3%85php8-1%e8%bf%87%e7%a8%8b%e8%ae%b0%e5%bd%95","status":"publish","type":"post","link":"https:\/\/www.yeetrack.com\/?p=1430","title":{"rendered":"\u7f16\u8bd1\u5b89\u88c5php8.1\u8fc7\u7a0b\u8bb0\u5f55"},"content":{"rendered":"<p>php\u6700\u65b0\u7248\u672c\u5df2\u7ecf\u5347\u7ea7\u52308.1.6\uff0c\u4e4b\u524d\u4e00\u76f4\u4f7f\u7528php7.2\uff0c\u8fd9\u4e24\u5929\u60f3\u5347\u7ea7\u52308.1.6\uff0c\u00a0\u4e2d\u95f4\u9047\u5230\u4e00\u4e9b\u95ee\u9898\uff0c\u6b65\u9aa4\u8bb0\u5f55\u5982\u4e0b<\/p>\n<ol>\n<li>\u4e0b\u8f7dphp8.1.6\u6e90\u7801\uff0c\u89e3\u538b<\/li>\n<\/ol>\n<pre><code>    wget https:\/\/www.php.net\/distributions\/php-8.1.6.tar.gz\n<\/code><\/pre>\n<ol start=\"2\">\n<li>\u7f16\u8bd1<\/li>\n<\/ol>\n<pre><code>    .\/configure --prefix=\/usr\/local\/php8.1 --enable-fpm  --with-mysqli --with-zlib --with-openssl\n    make\n<\/code><\/pre>\n<ol start=\"3\">\n<li>\u89e3\u51b3\u5185\u5b58\u4e0d\u8db3\u95ee\u9898 \u8d2d\u4e70\u7684\u4e91\u4e3b\u673a\u53ea\u67091G\u5185\u5b58\uff0c\u7f16\u8bd1\u8fc7\u7a0b\u4e2d\u62a5\u9519<strong>Cannot allocate memory<\/strong>\uff0c\u5185\u5b58\u4e0d\u591f\uff0c\u6682\u65f6\u4f7f\u7528\u4ea4\u6362\u5206\u533a\u89e3\u51b3<\/li>\n<\/ol>\n<pre><code>    sudo dd if=\/dev\/zero of=\/swapfile bs=64M count=16\n    sudo mkswap \/swapfile\n    sudo swapon \/swapfile\n<\/code><\/pre>\n<p>\u7f16\u8bd1\u5b8c\u6210\u4e4b\u540e\uff0c\u53ef\u4ee5\u518d\u5378\u8f7d\u4ea4\u6362\u5206\u533a<\/p>\n<pre><code>    sudo swapoff \/swapfile\n    sudo rm \/swapfile\n<\/code><\/pre>\n<ol start=\"4\">\n<li>\u89e3\u51b3phar\u62a5\u9519 \u7f16\u8bd1\u8fc7\u7a0b\u4e2d\uff0cphar\u62a5\u6bb5\u9519\u8bef\uff0c\u4e0d\u662fphar\u6587\u4ef6\u627e\u4e0d\u5230\uff0c\u7814\u7a76\u534a\u5929\u6ca1\u89e3\u51b3\uff0c\u6682\u65f6\u5173\u6389phar\u529f\u80fd\uff0cconfigure\u7684\u65f6\u5019\u7981\u7528phar\uff0c<code>--disable-phar<\/code><\/li>\n<\/ol>\n<pre><code>    .\/configure --prefix=\/usr\/local\/php8.1 --enable-fpm  --with-mysqli --with-zlib --with-openssl --disable-phar\n<\/code><\/pre>\n<ol start=\"5\">\n<li>\u5b89\u88c5\uff0c<code>make install<\/code><\/li>\n<li>php\u542f\u52a8segmentation fault \u5b89\u88c5\u5b8c\u6210\u4e4b\u540e\uff0c\u542f\u52a8php\u62a5\u6bb5\u9519\u8bef\uff0c<strong>Segmentation fault<\/strong>\uff0c\u5e76\u4e14\u6ca1\u6709\u4ea7\u751fcore\u6587\u4ef6\u3002<\/li>\n<li>\u89e3\u51b3\u6ca1\u6709\u4ea7\u751fcore\u6587\u4ef6\u95ee\u9898 \u53ef\u80fd\u662f\u56e0\u4e3alinux\u7cfb\u7edf\u9650\u5236\uff0c\u4f7f\u7528<code>ulimit -a<\/code>\u67e5\u770b\u4e00\u4e0b\n<pre><code> core file size          (blocks, -c) 0\n data seg size           (kbytes, -d) unlimited\n scheduling priority             (-e) 0\n file size               (blocks, -f) unlimited\n pending signals                 (-i) 7674\n max locked memory       (kbytes, -l) 65536\n max memory size         (kbytes, -m) unlimited\n open files                      (-n) 65535\n pipe size            (512 bytes, -p) 8\n POSIX message queues     (bytes, -q) 819200\n real-time priority              (-r) 0\n stack size              (kbytes, -s) 8192\n cpu time               (seconds, -t) unlimited\n max user processes              (-u) 7674\n virtual memory          (kbytes, -v) unlimited\n file locks                      (-x) unlimited\n<\/code><\/pre>\n<p>\u7b2c\u4e00\u884c<strong>core file size (blocks, -c) 0<\/strong>\uff0c\u8bf4\u660e\u4e0d\u5141\u8bb8\u4ea7\u751fcore\u6587\u4ef6\uff0c\u4f7f\u7528\u547d\u4ee4\u8c03\u6574\u4e00\u4e0b<\/li>\n<\/ol>\n<pre><code>    ulimit -c unlimited\n<\/code><\/pre>\n<p>\u6ce8\u610f\u8be5\u547d\u4ee4\u53ea\u5728\u5f53\u524dshell\u73af\u5883\u4e0b\u751f\u6548\uff0c\u5982\u679c\u6362\u4e2ashell\u4f1a\u8bdd\u8fd8\u4f1a\u6062\u590d\u64cd\u4f5c\u7cfb\u7edf\u9ed8\u8ba4\u7684\u914d\u7f6e\u3002<br \/>\n\u4fee\u6539core\u914d\u7f6e\u4e4b\u540e\uff0c\u518d\u6b21\u6267\u884cphp\uff0c\u4ea7\u751fcore\u6587\u4ef6<\/p>\n<pre><code>    :\/usr\/local\/php8.1-withssl\/bin# .\/php -i\n    Segmentation fault (core dumped)\n<\/code><\/pre>\n<p>\u4f7f\u7528gdb\u5206\u6790core\u6587\u4ef6\uff0c\u5f97\u5230\u5982\u4e0b\u9519\u8bef\u6808\uff1a<\/p>\n<pre><code>    #0  resolve_base64_encode () at \/root\/php-8.1.6\/ext\/standard\/base64.c:391\n    #1  0xb7f08d0c in elf_machine_rel (skip_ifunc=&lt;optimized out&gt;, reloc_addr_arg=&lt;optimized out&gt;, version=&lt;optimized out&gt;, sym=&lt;optimized out&gt;, reloc=0x4ed348,\nmap=0xb7f24940) at ..\/sysdeps\/i386\/dl-machine.h:475\n    #2  elf_dynamic_do_Rel (skip_ifunc=&lt;optimized out&gt;, lazy=&lt;optimized out&gt;, nrelative=&lt;optimized out&gt;, relsize=&lt;optimized out&gt;, reladdr=&lt;optimized out&gt;,\nmap=&lt;optimized out&gt;) at do-rel.h:137\n    #3  _dl_relocate_object (scope=&lt;optimized out&gt;, reloc_mode=&lt;optimized out&gt;, consider_profiling=&lt;optimized out&gt;) at dl-reloc.c:258\n    #4  0xb7f013c2 in dl_main (phdr=&lt;optimized out&gt;, phnum=&lt;optimized out&gt;, user_entry=&lt;optimized out&gt;, auxv=&lt;optimized out&gt;) at rtld.c:2190\n    #5  0xb7f150e1 in _dl_sysdep_start (start_argptr=0xbfe2caf0, dl_main=0xb7efee30 &lt;dl_main&gt;) at ..\/elf\/dl-sysdep.c:253\n    #6  0xb7efe9ff in _dl_start_final (arg=0xbfe2caf0) at rtld.c:414\n    #7  _dl_start (arg=&lt;optimized out&gt;) at rtld.c:521\n    #8  0xb7efdc7b in _start () from \/lib\/ld-linux.so.2\n<\/code><\/pre>\n<p>\u8868\u9762\u610f\u601d\u662fresolve_base64_encode\u51fd\u6570\u5f15\u8d77\u7684\u95ee\u9898\uff0c\u6682\u65f6\u5b9a\u4f4d\u4e0d\u5230\u5177\u4f53\u7684\u539f\u56e0<\/p>\n<ol start=\"8\">\n<li>openssl\u5f15\u8d77\u7684\u6bb5\u9519\u8bef\uff1f \u7ecf\u8fc7\u5c1d\u8bd5\uff0cconfigure\u53bb\u6389openssl\u6a21\u5757\uff0c\u91cd\u65b0\u7f16\u8bd1\u5b89\u88c5\uff0c\u8fd0\u884c\u6ca1\u95ee\u9898\u3002 \u53ef\u80fd\u662fopenssl\u7248\u672c\u7684\u95ee\u9898\uff0c\u4f46\u6362\u7528openssl-1.1.1\u4e4b\u540e\uff0c\u4f9d\u65e7\u662f\u76f8\u540c\u7684\u539f\u56e0\u62a5\u9519\u3002<\/li>\n<li>bison\u7248\u672c\u95ee\u9898\uff1f \u4ed4\u7ec6\u5206\u6790\u4ea7\u751fcoredump\u7684\u90a3\u884c\u4ee3\u7801\uff0cphp-8.1.6\/ext\/standard\/base64.c:391\uff0c\u662f\u4e00\u4e2a\u5f88\u666e\u901a\u7684\u51fd\u6570\u58f0\u660e\u7684\u4ee3\u7801\uff0c\u770b\u62a5\u9519\u5e94\u8be5\u662f\u6ca1\u6709\u89e3\u6790\u6210\u529f\uff0cphp\u662f\u7528bison\u6765\u89e3\u6790\u8bed\u6cd5\u7ed3\u6784\u7684\uff0c\u96be\u9053\u662fbison\u7248\u672c\u592a\u4f4e\u4e86\u5417\uff1f<br \/>\n\u6839\u636e\u5b98\u65b9\u7684php\u5b89\u88c5\u6b65\u9aa4\uff0c[https:\/\/www.php.net\/manual\/zh\/install.unix.php](<a href=\"https:\/\/www.php.net\/manual\/zh\/install.unix.php)%EF%BC%8Cphp7.4%E5%8F%8A%E5%85%B6%E4%BB%A5%E4%B8%8A%E7%89%88%E6%9C%AC%E8%A6%81%E6%B1%82bison%E9%AB%98%E4%BA%8E3.0%E7%89%88%E6%9C%AC%EF%BC%8C%E8%80%8C%E8%87%AA%E5%B7%B1%E7%9A%84%E4%BA%91%E4%B8%BB%E6%9C%BA%E4%B8%8Abison%E7%9A%84%E6%9C%80%E6%96%B0%E7%89%88%E6%9C%AC%E6%98%AF3.0.8%EF%BC%8C%E6%89%8B%E5%8A%A8%E5%AE%89%E8%A3%85%E5%88%B0%E6%9B%B4%E9%AB%98%E7%89%88%E6%9C%AC%E8%AF%95%E4%B8%80%E4%B8%8B%E3%80%82\">https:\/\/www.php.net\/manual\/zh\/install.unix.php)\uff0cphp7.4\u53ca\u5176\u4ee5\u4e0a\u7248\u672c\u8981\u6c42bison\u9ad8\u4e8e3.0\u7248\u672c\uff0c\u800c\u81ea\u5df1\u7684\u4e91\u4e3b\u673a\u4e0abison\u7684\u6700\u65b0\u7248\u672c\u662f3.0.8\uff0c\u624b\u52a8\u5b89\u88c5\u5230\u66f4\u9ad8\u7248\u672c\u8bd5\u4e00\u4e0b\u3002<\/a><\/li>\n<\/ol>\n<pre><code>    wget 'http:\/\/ftp.gnu.org\/gnu\/bison\/bison-3.8.tar.gz'\n    \u89e3\u538b\uff0cconfigure\uff0cmake\uff0cmake install\n<\/code><\/pre>\n<ol start=\"10\">\n<li>\u66f4\u65b0bison\u7248\u672c\u540e\uff0c\u7f16\u8bd1\u5b89\u88c5php\u4f9d\u65e7\u6709coredump\uff0c\u539f\u56e0\u4e0e\u4e0a\u9762\u4e00\u81f4\uff0c\u6682\u5b9a\u4f4d\u4e0d\u5230\u5176\u4ed6\u539f\u56e0\u4e86\uff0c\u55ef\u3002\u3002\u3002\u3002<\/li>\n<li>\u64cd\u4f5c\u7cfb\u7edf\u662fubuntu\uff0c\u90a3\u5c31\u4f7f\u7528apt\u5b89\u88c5\u8bd5\u8bd5\u5427\uff0c\u5b89\u88c5php\u7684\u66f4\u65b0\u6e90\u4e4b\u540e\uff0c\u76f4\u63a5apt install\u5373\u53ef\uff0c\u7136\u540e\u518d\u5b89\u88c5PHP\u7684\u62d3\u5c55\u5305\uff0c\u53c2\u8003:<a href=\"https:\/\/blog.csdn.net\/yisonphper\/article\/details\/116764005\">https:\/\/blog.csdn.net\/yisonphper\/article\/details\/116764005<\/a><\/li>\n<\/ol>\n<p>\u624b\u52a8\u7f16\u8bd1php\u9047\u5230\u7684\u95ee\u9898\uff0c\u6ca1\u6709\u89e3\u51b3\uff0c\u540e\u7eed\u7ee7\u7eed\u7814\u7a76\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>php\u6700\u65b0\u7248\u672c\u5df2\u7ecf\u5347\u7ea7\u52308.1.6\uff0c\u4e4b\u524d\u4e00\u76f4\u4f7f\u7528php7.2\uff0c\u8fd9\u4e24\u5929\u60f3\u5347\u7ea7\u52308.1.6\uff0c\u00a0\u4e2d\u95f4\u9047\u5230\u4e00\u4e9b\u95ee\u9898\uff0c\u6b65\u9aa4\u8bb0\u5f55\u5982\u4e0b \u4e0b\u8f7dphp8.1.6\u6e90\u7801\uff0c\u89e3\u538b wget https:\/\/www.php.ne&#46;&#46;&#46;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"pgc_sgb_lightbox_settings":"","footnotes":""},"categories":[34],"tags":[11,24],"class_list":["post-1430","post","type-post","status-publish","format-standard","hentry","category-software","tag-linux","tag-php"],"views":2004,"_links":{"self":[{"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/posts\/1430","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1430"}],"version-history":[{"count":2,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/posts\/1430\/revisions"}],"predecessor-version":[{"id":1432,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=\/wp\/v2\/posts\/1430\/revisions\/1432"}],"wp:attachment":[{"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1430"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1430"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yeetrack.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1430"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}