{"id":1130,"date":"2020-10-17T13:36:26","date_gmt":"2020-10-17T05:36:26","guid":{"rendered":"http:\/\/zeng.ga:1180\/?p=1130"},"modified":"2021-01-07T06:49:49","modified_gmt":"2021-01-06T22:49:49","slug":"wordpress%e8%bd%bb%e9%87%8f%e5%ba%94%e7%94%a8%e6%9c%8d%e5%8a%a1%e5%99%a8%e5%8d%87%e7%ba%a7php%e7%89%88%e6%9c%ac","status":"publish","type":"post","link":"https:\/\/blog.zengqq.com.cn\/?p=1130","title":{"rendered":"wordpress\u8f7b\u91cf\u5e94\u7528\u670d\u52a1\u5668\u5347\u7ea7php\u7248\u672c\uff08\u4e00\u952e\u5347\u7ea7\uff09"},"content":{"rendered":"\n<p><a href=\"https:\/\/developer.aliyun.com\/profile\/jnmny4aebmg4k\">\u4fee\u53e4<\/a>\u00a02019-09-08\u00a011706\u6d4f\u89c8\u91cf<strong>\u7b80\u4ecb\uff1a<\/strong>\u00a0\u8f7b\u91cf\u5e94\u7528\u670d\u52a1\u5668wordpress\u955c\u50cf\u9ed8\u8ba4\u4f7f\u7528php5.6\u7248\u672c\uff0cwordpress\u4f7f\u75284.8.1\u3002\u4f46\u662f\u8fd1\u671fwordpress\u66f4\u65b0\u4e86\u7248\u672c\uff0c\u8981\u6c42PHP\u7248\u672c\u4e0d\u4f4e\u4e8e7.3\uff0c\u5bfc\u81f4\u65e0\u6cd5\u6b63\u5e38\u4f7f\u7528\u65b0\u7248\u672cwordpress\uff0c\u672c\u6587\u4ecb\u7ecd\u5982\u4f55\u624b\u52a8\u7f16\u8bd1\u66f4\u65b0PHP\u52307.3\u3002\u4e00\u952e\u5347\u7ea7\u811a\u672c\u6587\u4ef6\u5728\u6587\u7ae0\u672b\u5c3e\u3002<\/p>\n\n\n\n<p>\u539f\u6587\u53d1\u8868\u4e8e\u6b64\uff1a<a rel=\"noreferrer noopener\" href=\"https:\/\/developer.aliyun.com\/article\/717769\" target=\"_blank\">https:\/\/developer.aliyun.com\/article\/717769<\/a><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">\u6ce8\u610f\u4e8b\u9879<\/h4>\n\n\n\n<ul class=\"wp-block-list\"><li>\u5efa\u8bae\u4f7f\u7528\u9ed8\u8ba4\u7684\u73af\u5883\u64cd\u4f5c<\/li><li>WordPress\u955c\u50cf\u7528\u7684\u662f4.8.1\u8fd9\u4e2a\u7248\u672c<\/li><\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">\u5b89\u88c5\u4f9d\u8d56<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">yum install -y libxml2-devel openssl-devel  curl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel xslt libxslt-devel\nyum update -y curl curl-devel\nyum remove -y libzip<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">\u914d\u7f6eSWAP<\/h4>\n\n\n\n<p>\u5982\u679c\u5185\u5b58\u662f\u4f4e\u4e8e1GB\u7684\uff0c\u5219\u9700\u8981\u914d\u7f6e\u4e00\u4e0bswap\uff0c\u7f16\u8bd1\u8fc7\u7a0b\u9700\u8981\u4f9d\u8d56\u66f4\u591a\u5185\u5b58\uff0c\u5185\u5b58\u592a\u4f4e\u4f1a\u62a5\u9519<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">dd if=\/dev\/zero of=\/swap bs=1M count=2048\nmkswap -f \/swap\nswapon \/swap<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">\u5b89\u88c5libzip<\/h4>\n\n\n\n<p>PHP7.3\u8981\u6c42libzip\u7248\u672c\u5927\u4e8e0.11\uff0c\u4f46yum\u5b89\u88c5\u7248\u672c\u8fbe\u4e0d\u5230\u8981\u6c42\uff0c\u6240\u4ee5\u8fd9\u91cc\u624b\u52a8\u7f16\u8bd1\u4e00\u4e0b\uff0c\u8be5\u9879\u4e0d\u6ee1\u8db3\u62a5\u9519\u5bf9\u5e94\u5982\u4e0b\uff1a<br><code>checking for libzip... configure: error: system libzip must be upgraded to version &gt;= 0.11<\/code><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">wget https:\/\/nih.at\/libzip\/libzip-1.2.0.tar.gz\ntar -zxvf libzip-1.2.0.tar.gz\ncd libzip-1.2.0\n.\/configure\nmake &amp;&amp; make install<\/pre>\n\n\n\n<p>\u7f16\u8bd1\u597d\u540e\u8fd8\u9700\u8981\u505a\u4e00\u4e0b\u8f6f\u8fde\u63a5\uff0c\u5426\u5219\u4f1a\u63d0\u793a\u62a5\u9519\u627e\u4e0d\u5230zipconf.h\u6587\u4ef6<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">ln -s \/usr\/local\/lib\/libzip\/include\/zipconf.h \/usr\/local\/include<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">\u7f16\u8bd1\u5b89\u88c5PHP<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">wget https:\/\/www.php.net\/distributions\/php-7.3.9.tar.gz\ntar -xvf php-7.3.9.tar.gz\ncd php-7.3.9\n.\/configure --prefix=\/usr\/local\/php73  --enable-soap --enable-cgi --with-mysql=\/usr\/local\/mysql --with-mysqli=mysqlnd --with-gd --with-pdo-mysql=mysqlnd --with-zlib --enable-zip --enable-fpm --without-pear --disable-phar --with-openssl --enable-mbstring=all --with-jpeg-dir=\/usr --with-png-dir=\/usr --with-curl --with-freetype-dir=\/usr --enable-gd-native-ttf --with-xsl=\/usr --enable-calendar --enable-exif --enable-ftp --with-iconv --enable-bcmath --with-mcrypt=\/usr\/local\/libmcrypt --enable-opcache\nmake &amp;&amp; make install<\/pre>\n\n\n\n<p>\u8fd9\u4e2a\u7f16\u8bd1\u8fc7\u7a0b\u4f1a\u6bd4\u8f83\u957f\uff0c\u7f16\u8bd1\u5b8c\u6210\u540e\u4fee\u6539\u4e00\u4e0b\u914d\u7f6e\u6587\u4ef6<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># \u5c06\u542f\u52a8\u811a\u672c\u590d\u5236\u5230init.d\u4e2d\uff0c${PHP73}\u5bf9\u5e94\u662f\u6e90\u7801\u89e3\u538b\u7684\u76ee\u5f55\ncp ${PHP73}\/sapi\/fpm\/init.d.php-fpm \/etc\/init.d\/php-fpm73\n# \u7ed9\u542f\u52a8\u811a\u672c\u52a0\u4e0a\u6267\u884c\u6743\u9650\nchmod +x \/etc\/init.d\/php-fpm73\n# \u5c06\u9ed8\u8ba4\u914d\u7f6e\u6587\u4ef6\u590d\u5236\u4e3a.conf\u6587\u4ef6\ncp \/usr\/local\/php73\/etc\/php-fpm.conf.default ${PHP73_DIR}\/etc\/php-fpm.conf\n# \u6dfb\u52a0pool\u7684\u914d\u7f6e\ncat &lt;&lt; EOF > \/usr\/local\/php73\/etc\/php-fpm.d\/www.conf\n<\/pre>\n\n\n<p>[www]<\/p>\n\n\n\n<p>listen = \/home\/www\/logs\/php73-fpm.sock listen.mode = 0666 user = www group = www pm = dynamic pm.max_children = 128 pm.start_servers = 5 pm.min_spare_servers = 5 pm.max_spare_servers = 15 pm.max_requests = 300 rlimit_files = 1024 slowlog = \/home\/www\/logs\/php73-fpm-slow.log EOF<\/p>\n\n\n\n<p>\u81f3\u6b64PHP\u5df2\u7ecf\u7f16\u8bd1\u914d\u7f6e\u5b8c\u6210\uff0c\u63a5\u4e0b\u6765\u9700\u8981\u4fee\u6539apache\u4f7f\u7528\u65b0\u7248\u7684php<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">\u4fee\u6539apache<\/h4>\n\n\n\n<p>\u955c\u50cf\u4e2d\u9ed8\u8ba4\u662f\u7528\u7684php-fpm\uff0c\u4f7f\u7528\u7684\u662fsocket\u65b9\u5f0f\u7684\u76d1\u542c\uff0cApache\u5bf9\u5e94\u914d\u7f6e\u6587\u4ef6<code>\/usr\/local\/apache\/conf\/httpd.conf<\/code>,\u53ef\u4ee5\u770b\u5230\u5176\u4e2d\u914d\u7f6e\u5982\u4e0b<br><img decoding=\"async\" src=\"https:\/\/yqfile.alicdn.com\/f311d56d2971fb7baccb61c515f7e0bbdc69f7cb.png\" alt=\"image\"><\/p>\n\n\n\n<p>\u6211\u4eec\u53ea\u9700\u8981\u4fee\u6539\u5176\u4e2dsocket\u7684\u6587\u4ef6\u8def\u5f84\u6307\u5411\u5230\u65b0\u7248\u672c\u7684PHP\u5c31\u53ef\u4ee5\u4e86\uff0c\u5728<code>\/usr\/local\/php73\/etc\/php-fpm.d\/www.conf<\/code>\u6709\u6307\u5b9a\uff0c\u65b0\u7684\u914d\u7f6e\u5230<code>\/home\/www\/logs\/php73-fpm.sock<\/code>\u5373\u53ef\uff0c\u5982\u56fe<br><img decoding=\"async\" src=\"https:\/\/yqfile.alicdn.com\/9d9587e2fdc0b2c69c5dacc9561ba69af7525aa0.png\" alt=\"image\"><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">\u91cd\u542f\u670d\u52a1<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># \u505c\u6b62\u65e7\u7248\u672c\u7684PHP(\u5b9e\u9645\u4e0d\u505c\u6b62\u4e5f\u4e0d\u5f71\u54cd\uff0c\u505c\u6b62\u53ef\u4ee5\u51cf\u5c11\u4e00\u4e9b\u7cfb\u7edf\u8d44\u6e90\u5360\u7528)\n\/etc\/init.d\/php-fpm stop\n# \u542f\u52a8\u65b0\u7248PHP-FPM\n\/etc\/init.d\/php-fpm73 start\n# \u91cd\u542fapache\n\/etc\/init.d\/apachectl restart<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">\u9a8c\u8bc1<\/h4>\n\n\n\n<p>\u7ad9\u70b9\u6839\u76ee\u5f55\u662f<code>\/home\/www\/htdocs\/<\/code>\uff0c\u653e\u5165phpinfo\u63a2\u9488\u5373\u53ef\u68c0\u6d4bPHP\u7248\u672c<br><img decoding=\"async\" src=\"https:\/\/yqfile.alicdn.com\/b17d5dfbf74d763bbcbdbaddb8747e8b68a0010b.png\" alt=\"image\"><\/p>\n\n\n\n<p>\u81f3\u6b64\u8f7b\u91cf\u5e94\u7528\u670d\u52a1\u5668wordpress\u955c\u50cf\u66f4\u65b0PHP\u7248\u672c\u64cd\u4f5c\u5df2\u5b8c\u6210\uff0c\u53ef\u4ee5\u6109\u5feb\u7684\u66f4\u65b0wordpress\u5230\u65b0\u7248\u672c\u4e86\u3002\u4e3a\u4e86\u64cd\u4f5c\u66f4\u7b80\u5355\uff0c\u8fd9\u91cc\u603b\u7ed3\u6210\u4e86\u4e00\u4e2a\u811a\u672c\uff0c\u53ef\u4ee5\u590d\u5236\u5230\u4e3b\u673a\u5185\u4e00\u952e\u6267\u884c<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">#!\/bin\/bash\nWORKDIR=\/tmp\/\nPHP73_DIR=\/usr\/local\/php73\nDEFAULT_SWAP=0\n\ncreateSwap(){\n  if [ `cat \/proc\/meminfo | grep SwapTotal | awk -F \" \" '{print $2}'` -ne 0 ]\n  then\n    return 0\n  fi\n  if [ `cat \/proc\/meminfo | grep MemTotal | awk -F \" \" '{print $2}'` -le 1048576 ]\n  then\n    echo \"Mem lower than 1GB,creating swap...\"\n    dd if=\/dev\/zero of=\/swap bs=1M count=2048\n    mkswap -f \/swap\n    swapon \/swap &amp;&amp; echo \"SWAP create success.\"\n    DEFAULT_SWAP=1\n  fi\n}\n\ninstallDependence(){\n  yum install -y libxml2-devel openssl-devel  curl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel xslt libxslt-devel\n  yum update -y curl curl-devel\n  yum remove -y libzip\n}\n\ncompileLibzip(){\n  echo \"start install libzip.\"\n  cd ${WORKDIR}\n  if [ -f libzip-1.2.0.tar.gz ]\n  then\n    rm -rf libzip-1.2.0.tar.gz\n  fi\n  wget https:\/\/code.aliyun.com\/yh11\/download\/raw\/master\/libzip-1.2.0.tar.gz\n  tar -zxvf libzip-1.2.0.tar.gz\n  cd libzip-1.2.0\n  .\/configure\n  make &amp;&amp; make install\n  if [ $? -ne 0 ]\n  then\n    echo \"libzip install failed.\"\n    exit 127\n  fi\n  ln -s \/usr\/local\/lib\/libzip\/include\/zipconf.h \/usr\/local\/include\n}\n\ninstallPHP(){\n  echo \"Install PHP 7.3\"\n  cd ${WORKDIR}\n  if [ -f php-7.3.9.tar.gz ]\n  then\n    rm -rf php-7.3.9.tar.gz\n  fi\n  wget https:\/\/code.aliyun.com\/yh11\/download\/raw\/master\/php-7.3.9.tar.gz\n  tar -xvf php-7.3.9.tar.gz\n  cd php-7.3.9\n  .\/configure --prefix=\/usr\/local\/php73  --enable-soap --enable-cgi --with-mysql=\/usr\/local\/mysql --with-mysqli=mysqlnd --with-gd --with-pdo-mysql=mysqlnd --with-zlib --enable-zip --enable-fpm --without-pear --disable-phar --with-openssl --enable-mbstring=all --with-jpeg-dir=\/usr --with-png-dir=\/usr --with-curl --with-freetype-dir=\/usr --enable-gd-native-ttf --with-xsl=\/usr --enable-calendar --enable-exif --enable-ftp --with-iconv --enable-bcmath --with-mcrypt=\/usr\/local\/libmcrypt --enable-opcache\n  make &amp;&amp; make install\n  if [ $? -ne 0 ]\n  then\n    echo \"PHP install failed.\"\n    exit 127\n  fi\n  cp sapi\/fpm\/init.d.php-fpm \/etc\/init.d\/php-fpm73\n  cp ${PHP73_DIR}\/etc\/php-fpm.conf.default ${PHP73_DIR}\/etc\/php-fpm.conf\n  chmod +x \/etc\/init.d\/php-fpm73\n}\n\ncreateConfig(){\n# \u6dfb\u52a0pool\u7684\u914d\u7f6e\ncat &lt;&lt; EOF > ${PHP73_DIR}\/etc\/php-fpm.d\/www.conf\n[www]\nlisten = \/home\/www\/logs\/php73-fpm.sock\nlisten.mode = 0666\nuser = www\ngroup = www\npm = dynamic\npm.max_children = 128\npm.start_servers = 5\npm.min_spare_servers = 5\npm.max_spare_servers = 15\npm.max_requests = 300\nrlimit_files = 1024\nslowlog = \/home\/www\/logs\/php73-fpm-slow.log\nEOF\n\n}\n\nmodifyApache(){\n  sed -i 's#ProxyPassMatch ^\/(.*\\.php(\/.*)?)$ unix:\/home\/www\/logs\/php-fpm.sock|fcgi:\/\/127.0.0.1\/home\/www\/htdocs#ProxyPassMatch ^\/(.*\\\\.php(\/.*)?)$ unix:\/home\/www\/logs\/php73-fpm.sock|fcgi:\/\/127.0.0.1\/home\/www\/htdocs#g' \/usr\/local\/apache\/conf\/httpd.conf\n}\n\nrestartService(){\n  chkconfig php-fpm off\n  chkconfig php-fpm73 on\n  \/etc\/init.d\/php-fpm stop\n  \/etc\/init.d\/php-fpm73 start\n  \/etc\/init.d\/apachectl restart\n}\n\ndelSwap(){\n  if [ ${DEFAULT_SWAP} -eq 1 ]\n  then\n    swapoff \/swap\n    rm -rf \/swap\n  fi\n}\n\ncreateSwap\ninstallDependence\ncompileLibzip\ninstallPHP\ncreateConfig\nmodifyApache\nrestartService\ndelSwap<\/pre>\n\n\n\n<p><strong>\u7248\u6743\u58f0\u660e\uff1a<\/strong>\u672c\u6587\u5185\u5bb9\u7531\u963f\u91cc\u4e91\u5b9e\u540d\u6ce8\u518c\u7528\u6237\u81ea\u53d1\u8d21\u732e\uff0c\u7248\u6743\u5f52\u539f\u4f5c\u8005\u6240\u6709\uff0c\u963f\u91cc\u4e91\u5f00\u53d1\u8005\u793e\u533a\u4e0d\u62e5\u6709\u5176\u8457\u4f5c\u6743\uff0c\u4ea6\u4e0d\u627f\u62c5\u76f8\u5e94\u6cd5\u5f8b\u8d23\u4efb\u3002\u5177\u4f53\u89c4\u5219\u8bf7\u67e5\u770b\u300a<a href=\"https:\/\/developer.aliyun.com\/article\/768092\">\u963f\u91cc\u4e91\u5f00\u53d1\u8005\u793e\u533a\u7528\u6237\u670d\u52a1\u534f\u8bae<\/a>\u300b\u548c\u300a<a href=\"https:\/\/developer.aliyun.com\/article\/768093\">\u963f\u91cc\u4e91\u5f00\u53d1\u8005\u793e\u533a\u77e5\u8bc6\u4ea7\u6743\u4fdd\u62a4\u6307\u5f15<\/a>\u300b\u3002\u5982\u679c\u60a8\u53d1\u73b0\u672c\u793e\u533a\u4e2d\u6709\u6d89\u5acc\u6284\u88ad\u7684\u5185\u5bb9\uff0c\u586b\u5199<a href=\"https:\/\/yida.alibaba-inc.com\/o\/right\">\u4fb5\u6743\u6295\u8bc9\u8868\u5355<\/a>\u8fdb\u884c\u4e3e\u62a5\uff0c\u4e00\u7ecf\u67e5\u5b9e\uff0c\u672c\u793e\u533a\u5c06\u7acb\u523b\u5220\u9664\u6d89\u5acc\u4fb5\u6743\u5185\u5bb9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4fee\u53e4\u00a02019-09-08\u00a011706\u6d4f\u89c8\u91cf\u7b80\u4ecb\uff1a [&#8230;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[89],"tags":[57,217,214,212,213,211,215,216],"class_list":["post-1130","post","type-post","status-publish","format-standard","hentry","category-live","tag-php7-3","tag-php7-3libzip0-11","tag-yum","tag-212","tag-php","tag-211","tag-1g","tag-swap"],"_links":{"self":[{"href":"https:\/\/blog.zengqq.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/1130","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.zengqq.com.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.zengqq.com.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.zengqq.com.cn\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.zengqq.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1130"}],"version-history":[{"count":3,"href":"https:\/\/blog.zengqq.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/1130\/revisions"}],"predecessor-version":[{"id":1493,"href":"https:\/\/blog.zengqq.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/1130\/revisions\/1493"}],"wp:attachment":[{"href":"https:\/\/blog.zengqq.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1130"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.zengqq.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1130"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.zengqq.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1130"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}