{"id":587,"date":"2015-06-29T14:22:05","date_gmt":"2015-06-29T06:22:05","guid":{"rendered":"http:\/\/www.zyuns.com\/?p=587"},"modified":"2015-06-29T14:22:05","modified_gmt":"2015-06-29T06:22:05","slug":"php%e8%bf%90%e8%a1%8c%e7%a5%9e%e5%99%a8-%e7%94%a8hhvm%e5%87%8f%e5%b0%91%e4%bd%a0%e4%b8%80%e5%8d%8a%e7%9a%84%e6%9c%8d%e5%8a%a1%e5%99%a8","status":"publish","type":"post","link":"https:\/\/www.siediyer.cn\/?p=587","title":{"rendered":"PHP\u8fd0\u884c\u795e\u5668&#8211;\u7528HHVM\u51cf\u5c11\u4f60\u4e00\u534a\u7684\u670d\u52a1\u5668"},"content":{"rendered":"<div id=\"art_desc\"><\/div>\n<pre class=\"lang:default decode:true \">Hiphop\u662fFacebook\u5f00\u53d1\u4e00\u6b3ePHP\u4e8c\u8fdb\u5236\u5316\u7684\u4e00\u4e2a\u5de5\u5177\uff0c\u6700\u5f00\u59cb\u662f\u7531php\u8f6c\u4e3aC++\uff0c\u4f46\u662f\u540e\u6765\u53d1\u73b0\u7f16\u8bd1\u4e3ac++\u7684\u8bdd\uff0c\u8bb8\u591a\u7684\u65f6\u95f4\u4f1a\u82b1\u8d39\u5728\u7f16\u8bd1\u4ee3\u7801\u4e0a\u9762\uff0c\u8c03\u8bd5\u4e0d\u65b9\u4fbf\uff0c\u5bf9\u4e8e\u4ee3\u7801\u6765\r\n\u00a0\r\nHiphop\u662fFacebook\u5f00\u53d1\u4e00\u6b3ePHP\u4e8c\u8fdb\u5236\u5316\u7684\u4e00\u4e2a\u5de5\u5177\uff0c\u6700\u5f00\u59cb\u662f\u7531php\u8f6c\u4e3aC++\uff0c\u4f46\u662f\u540e\u6765\u53d1\u73b0\u7f16\u8bd1\u4e3ac++\u7684\u8bdd\uff0c\u8bb8\u591a\u7684\u65f6\u95f4\u4f1a\u82b1\u8d39\u5728\u7f16\u8bd1\u4ee3\u7801\u4e0a\u9762\uff0c\u8c03\u8bd5\u4e0d\u65b9\u4fbf\uff0c\u5bf9\u4e8e\u4ee3\u7801\u6765\u8bf4\u4e5f\u4e0d\u662f\u5373\u89c1\u5373\u6240\u5f97\u3002<\/pre>\n<p>&nbsp;<\/p>\n<p>\u6240\u4ee5hiphop\u7ecf\u5386\u4e86\u8fd9\u4e48\u51e0\u4e2a\u9636\u6bb5\uff1a<\/p>\n<p>HPHPC=&gt;HPHPI=&gt;HHVM<\/p>\n<p>HPHPC\u662f\u9759\u6001\u7f16\u8bd1\uff0c\u4e5f\u5c31\u662f\u628aphp\u8f6c\u4e3ac++<\/p>\n<p>HPHPI\u662f\u4e00\u4e2a\u8fc7\u6e21\u4ea7\u54c1\uff0c\u7c7b\u4f3cphp zend\u865a\u62df\u673a\uff0c\u6027\u80fd\u8fd8\u4e0d\u5982zend\u865a\u62df\u673a\uff0c\u4f46\u662f\u53ef\u4ee5\u8fd0\u884c\u67e5\u770b\u6548\u679c\uff1b<\/p>\n<p>HHVM\u662f\u5728HPHPI\u57fa\u7840\u4e0a\uff0c\u5e94\u7528\u4e86JIT\u6280\u672f\uff0c\u6027\u80fd\u5df2\u7ecf\u63a5\u8fd1\u4e86HPHPC,\u76ee\u524dfacebook\u6253\u7b97\u6162\u6162\u629b\u5f03HPHPC\uff1b<\/p>\n<p>\u6027\u80fd\u4e0aHPHPC\u548cHHVM\u6bd4zend\u865a\u62df\u673a+\u52a0\u901f\u5668\u8981\u8282\u7ea6cpu\u572850%\u5728300%\u95f4\uff08\u5b98\u65b9\u63d0\u4f9b\uff09\uff0c\uff0c\u6211\u5b9e\u9645\u5e94\u7528\u4e2d\uff0c\u4e00\u822c\u8282\u7ea6CPU\u5728100%-300%\u95f4\u5de6\u53f3\uff0c\u6d41\u91cf\u8d8a\u5927\u8d8a\u660e\u663e\u3002<\/p>\n<p>\u4ee5\u4e0a\u5185\u5bb9\u6458\u81ea<\/p>\n<p>\u6700\u8fd1\u5bf9\u8fd9\u4e1c\u897f\u505a\u4e86\u4e00\u4e9b\u90e8\u7f72\u6d4b\u8bd5\uff0c\u786e\u5b9e\u53d1\u73b0\u5f88\u597d\uff0c\u57fa\u672c\u964d\u4f4eCPU\u5360\u752850%\u4ee5\u4e0a\u662f\u6ca1\u6709\u4efb\u4f55\u95ee\u9898\u7684\u3002\u800c\u4e14\u8fd9\u4e1c\u897f\u5df2\u7ecf\u5728\u56fd\u5185\u67d0\u5927\u578b\u7535\u5546\u7f51\u7ad9\u7ebf\u4e0a\u4f7f\u7528\u4e861\u5e74\u591a\u4e86\uff0c\u76f8\u5173\u5f00\u6e90\u7231\u597d\u8005\u4e5f\u8d21\u732e\u4e86\u4e00\u4e9bbug\u4fee\u590d\u8865\u4e01\u548c\u6a21\u5757\u6269\u5c55\u3002<\/p>\n<p>\u76ee\u524d\u56fd\u5185\u5916\u5bf9\u8fd9\u4e00\u795e\u5668\u7684\u7814\u7a76\u90fd\u6bd4\u8f83\u5c11\uff0c\u4e3b\u8981\u7684\u95ee\u9898\u6211\u5206\u6790\u4e86\u4e0b\u67093\u4e2a<\/p>\n<p>1.\u5b98\u65b9\u4e0d\u591f\u6d3b\u8dc3\uff0c\u5305\u62ec\u76ee\u524d\u7684\u7248\u672c\u8fd8\u6709\u4e00\u4e9bbug\uff0c\u6bd4\u5982\u5728HHVM1.0\u4e0b\u7684libevent\u5185\u5b58\u6cc4\u9732\uff0c\u5230\u4e86HHVM2.1\u4e0a\u8fd8\u672a\u5f97\u5230\u89e3\u51b3\u3002<\/p>\n<p>2.\u76ee\u524d\u5bf9PHP\u7b2c\u4e09\u65b9\u6a21\u5757\u7684\u652f\u6301\u8f83\u5c11\uff0c\u6bd4\u5982\u5bf9MongoDB\u7684\u6269\u5c55\uff0c\u5bf9\u4e8eRedis\u6a21\u5757\u53ea\u63d0\u4f9b\u4e86\u6700\u57fa\u672c\u7684\u529f\u80fd\u51fd\u6570\uff0c\u9ad8\u7ea7\u7684\u4e1c\u897f\u8fd8\u662f\u9700\u8981\u5728php\u4ee3\u7801\u5c42\u53bb\u5b9e\u73b0\u3002<\/p>\n<p>3.\u793e\u533a\u4e0d\u591f\u6d3b\u8dc3\uff0c\u8fd9\u4e5f\u662f\u6700\u4e3b\u8981\u7684\u4e00\u4e2a\u95ee\u9898<\/p>\n<p>\u5728\u8fd9\u91cc\u6211\u628a\u6700\u8fd1\u5bf9\u8fd9\u4e1c\u897f\u7684\u4e00\u4e9b\u7b80\u5355\u7684\u7814\u7a76\u5206\u4eab\u4e00\u4e0b\uff0c\u5bf9\u8fd9\u73a9\u610f\u513f\u6709\u5174\u8da3\u7684\u7ae5\u978b\u53ef\u4ee5\u52a0\u7fa4\u8ba8\u8bba\uff1a<\/p>\n<p>HHVM\u5b66\u4e60\u7814\u7a76 \u7fa4\u53f7\uff1a271240899<\/p>\n<p>\u76ee\u524d\u6700\u65b0\u7684\u5b98\u65b92.1\u7248\u672c\u8fd8\u5b58\u5728\u7740\u5185\u5b58\u6cc4\u9732\u7684\u95ee\u9898\uff0c\u5bf9redis\u7684\u652f\u6301\u53ea\u662f\u63d0\u4f9b\u4e86\u6700\u57fa\u672c\u7684\u529f\u80fd\uff08\u6211\u4eec\u9700\u8981\u4f7f\u7528redis\uff0c\u6240\u4ee5\u5bf9\u8fd9\u4e00\u5757\u6bd4\u8f83\u5728\u610f\uff0c\u5176\u5b83\u7684\u6269\u5c55\u53ef\u4ee5\u53bb\u67e5\u770b\u5b98\u65b9\u652f\u6301\u5217\u8868\uff1ahttps:\/\/github.com\/facebook\/hiphop-php\/tree\/master\/hphp\/runtime\/ext\uff09<\/p>\n<p>\u6e90\u7801\u5b89\u88c5\u8fc7\u4e8e\u9ebb\u70e6\uff0c\u60f3\u5c1d\u9c9c\u7684\u5efa\u8baeyum\uff0c\u5b98\u65b9\u7684\u6e90\u7801\u5b89\u88c5\u6587\u6863\uff1ahttps:\/\/github.com\/facebook\/hiphop-php\/wiki\/Building-and-installing-HHVM-on-CentOS-6.3<\/p>\n<p>\u53c2\u7167\u5b98\u65b9\u7684\u5b89\u88c5\u65b9\u5f0f\uff0c\u7528\u5b98\u65b9\u63d0\u4f9b\u7684yum\u6e90\u8fdb\u884c\u5b89\u88c5\uff0c\u5728\u535a\u4e3b\u7684\u652f\u6301\u4e0b\u4fee\u590d\u4e86libevent\u7684\u5185\u5b58\u6cc4\u9732\u95ee\u9898<\/p>\n<p>Step1\uff1a\u8bbe\u7f6e\u597dyum\u6e90<\/p>\n<p>rpm -ivh<\/p>\n<p>wget -O \/etc\/yum.repos.d\/hop5.repo<\/p>\n<p>yum clean all<\/p>\n<p>Step2\uff1a\u5b89\u88c5\u597d\u57fa\u7840\u73af\u5883\u5305\u3002\u3002\u3002\u6bd4\u8f83\u591a\u3002\u3002\u3002<\/p>\n<p>rpm -ivh ftp:\/\/rpmfind.net\/linux\/epel\/beta\/6\/x86_64\/libmcrypt-2.5.8-9.el6.x86_64.rpm<\/p>\n<p>rpm -ivh ftp:\/\/rpmfind.net\/linux\/epel\/beta\/6\/x86_64\/libmcrypt-devel-2.5.8-9.el6.x86_64.rpm<\/p>\n<p>yum install git svn cpp make autoconf automake libtool patch memcached gcc-c++ cmake wget boost-devel mysql-devel pcre-devel gd-devel libxml2-devel expat-devel libicu-devel bzip2-devel oniguruma-devel openldap-devel readline-devel libc-client-devel libcap-devel binutils-devel pam-devel elfutils-libelf-devel tbb-devel libdwarf-devel dbus-cxx-devel libunwind-devel php-mssql libtool<\/p>\n<p>\u5982\u679c\u51c6\u5907\u7f16\u8bd1\u5b89\u88c5\u7684\u8bdd\uff0c\u88c5\u4ee5\u4e0b\u7684\u5305\u5c31\u80fd\u591f\u642d\u5efa\u597d\u7f16\u8bd1\u73af\u5883\uff0c\u5982\u679c\u4e0d\u50cf\u7f16\u8bd1\u5b89\u88c5\u5219\u7565\u8fc7<\/p>\n<p>yum install -y boost.x86_64 \\<\/p>\n<p>boost-chrono.x86_64 \\<\/p>\n<p>boost-date-time.x86_64 \\<\/p>\n<p>boost-devel.x86_64 \\<\/p>\n<p>boost-filesystem.x86_64 \\<\/p>\n<p>boost-graph.x86_64 \\<\/p>\n<p>boost-graph-mpich2.x86_64 \\<\/p>\n<p>boost-graph-openmpi.x86_64 \\<\/p>\n<p>boost-iostreams.x86_64 \\<\/p>\n<p>boost-jam.x86_64 \\<\/p>\n<p>boost-locale.x86_64 \\<\/p>\n<p>boost-math.x86_64 \\<\/p>\n<p>boost-mpich2.x86_64 \\<\/p>\n<p>boost-mpich2-devel.x86_64 \\<\/p>\n<p>boost-mpich2-python.x86_64 \\<\/p>\n<p>boost-openmpi.x86_64 \\<\/p>\n<p>boost-openmpi-devel.x86_64 \\<\/p>\n<p>boost-openmpi-python.x86_64 \\<\/p>\n<p>boost-program-options.x86_64 \\<\/p>\n<p>boost-python.x86_64 \\<\/p>\n<p>boost-random.x86_64 \\<\/p>\n<p>boost-regex.x86_64 \\<\/p>\n<p>boost-serialization.x86_64 \\<\/p>\n<p>boost-signals.x86_64 \\<\/p>\n<p>boost-static.x86_64 \\<\/p>\n<p>boost-system.x86_64 \\<\/p>\n<p>boost-test.x86_64 \\<\/p>\n<p>boost-thread.x86_64 \\<\/p>\n<p>boost-timer.x86_64 \\<\/p>\n<p>boost-wave.x86_64 \\<\/p>\n<p>cpp.x86_64 \\<\/p>\n<p>curl.x86_64 \\<\/p>\n<p>gcc.x86_64 \\<\/p>\n<p>gcc-c++.x86_64 \\<\/p>\n<p>gcc-gfortran.x86_64 \\<\/p>\n<p>gcc-objc.x86_64 \\<\/p>\n<p>gcc-objc++.x86_64 \\<\/p>\n<p>gcc-plugin-devel.x86_64 \\<\/p>\n<p>glog.x86_64 \\<\/p>\n<p>glog-devel.x86_64 \\<\/p>\n<p>gmp.x86_64 \\<\/p>\n<p>gmp-devel.x86_64 \\<\/p>\n<p>gmp-static.x86_64 \\<\/p>\n<p>golang.x86_64 \\<\/p>\n<p>libcurl.x86_64 \\<\/p>\n<p>libcurl-devel.x86_64 \\<\/p>\n<p>libdwarf.x86_64 \\<\/p>\n<p>libdwarf-devel.x86_64 \\<\/p>\n<p>libdwarf-static.x86_64 \\<\/p>\n<p>libdwarf-tools.x86_64 \\<\/p>\n<p>libevent.x86_64 \\<\/p>\n<p>libevent-devel.x86_64 \\<\/p>\n<p>libgcc.x86_64 \\<\/p>\n<p>libgfortran.x86_64 \\<\/p>\n<p>libgfortran-static.x86_64 \\<\/p>\n<p>libgomp.x86_64 \\<\/p>\n<p>libmemcached.x86_64 \\<\/p>\n<p>libmemcached-devel.x86_64 \\<\/p>\n<p>libmpc.x86_64 \\<\/p>\n<p>libmpc-devel.x86_64 \\<\/p>\n<p>libmudflap.x86_64 \\<\/p>\n<p>libmudflap-devel.x86_64 \\<\/p>\n<p>libmudflap-static.x86_64 \\<\/p>\n<p>libobjc.x86_64 \\<\/p>\n<p>libquadmath.x86_64 \\<\/p>\n<p>libquadmath-devel.x86_64 \\<\/p>\n<p>libquadmath-static.x86_64 \\<\/p>\n<p>libstdc++.x86_64 \\<\/p>\n<p>libstdc++-devel.x86_64 \\<\/p>\n<p>libstdc++-static.x86_64 \\<\/p>\n<p>libtool.x86_64 \\<\/p>\n<p>libtool-ltdl.x86_64 \\<\/p>\n<p>libtool-ltdl-devel.x86_64 \\<\/p>\n<p>lxc.x86_64 \\<\/p>\n<p>lxc-devel.x86_64 \\<\/p>\n<p>lxc-doc.x86_64 \\<\/p>\n<p>lxc-libs.x86_64 \\<\/p>\n<p>lxc-templates.x86_64 \\<\/p>\n<p>mpfr.x86_64 \\<\/p>\n<p>mpfr-devel.x86_64 \\<\/p>\n<p>nginx.x86_64 \\<\/p>\n<p>tbb.x86_64 \\<\/p>\n<p>tbb-devel.x86_64 \\<\/p>\n<p>tbb-doc.x86_64 \\<\/p>\n<p>\u5982\u679c\u8fd9\u91cc\u5b89\u88c5 golang \u5305\u62a5\u9519\u53ef\u4ee5\u9009\u62e9\u4e0d\u5b89\u88c5\u8fd9\u4e2a\u5305<\/p>\n<p>\u5982\u679c\u4e0d\u662f\u7f16\u8bd1\u5b89\u88c5\uff0c\u53ea\u8981\u6267\u884c<\/p>\n<p>yum install hiphop-php<\/p>\n<p>Step3\uff1a\u89e3\u51b3HHVM\u5bf9\u4e8elibevent\u7684\u5185\u5b58\u6cc4\u9732\u95ee\u9898<\/p>\n<p>git\u4e0blibevent\u548chhvm\u7684\u6e90\u7801\u5305\uff0c\u4e4b\u6240\u4ee5\u8981hhvm\u7684\u6e90\u7801\u5305\uff0c\u662f\u8981\u5728libevent\u6e90\u7801\u4e2d\u6253\u5165hhvm\u63d0\u4f9b\u7684\u9488\u5bf9libevent\u7684\u8865\u4e01\uff0c\u624d\u80fd\u8ba9libevent\u652f\u6301hhvm<\/p>\n<p>git clone git:\/\/github.com\/libevent\/libevent.git<\/p>\n<p>git clone git:\/\/github.com\/facebook\/hiphop-php.git<\/p>\n<p>cd libevent\/<\/p>\n<p>git checkout release-1.4.14b-stable<\/p>\n<p>\u6253\u8865\u4e01<\/p>\n<p>cat ..\/hiphop-php\/hphp\/third_party\/libevent-1.4.14.fb-changes.diff | patch -p1<\/p>\n<p>\u6253\u5b8c\u8865\u4e01\u540e\u6539\u4fee\u4e00\u4e0blibevent\u7684http.c\u6587\u4ef6\uff0c\u89e3\u51b3\u5185\u5b58\u6cc4\u9732\u7684\u5173\u952e<\/p>\n<p>\u5927\u6982\u57282319\u884c\u8fd9\u91cc\uff0c\u5728<\/p>\n<p>if (req-&gt;evcon-&gt;state == EVCON_DISCONNECTED) {<\/p>\n<p>\u4e0b\u9762\uff0c\u589e\u52a0<\/p>\n<p>req-&gt;userdone = 1;<\/p>\n<p>Step4.\u7f16\u8bd1\u5b89\u88c5libevent<\/p>\n<p>.\/autogen.sh<\/p>\n<p>.\/configure &#8211;prefix=\/usr\/ &#8211;libdir=\/usr\/lib64\/ \u00a0#\u6ce8\u610f\u8def\u5f84\u4e0d\u8981\u51fa\u9519\uff0c\u8fd9\u91cc\u662f\u8986\u76d6\u4e86rpm\u5b89\u88c5\u7684libevent<\/p>\n<p>make &amp;&amp; make install<\/p>\n<p>ok&#8230;\u5b89\u88c5\u5b8c\u6bd5<\/p>\n<p>\u81f3\u6b64\uff0c<\/p>\n<p>\u8fd0\u884cphp\u811a\u672c\u76f4\u63a5\u6267\u884chhvm script.php\u5c31\u884c\u4e86<\/p>\n<p>hhvm\u4f1a\u628aphp\u5148\u7f16\u8bd1\u6210c++\u7684\u4ee3\u7801\u518d\u53bb\u8fd0\u884c<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hiphop\u662fFacebook\u5f00\u53d1\u4e00\u6b3ePHP\u4e8c\u8fdb\u5236\u5316\u7684\u4e00\u4e2a\u5de5\u5177\uff0c\u6700\u5f00\u59cb\u662f\u7531php\u8f6c\u4e3aC++\uff0c\u4f46\u662f\u540e\u6765\u53d1\u73b0\u7f16\u8bd1\u4e3a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[31],"class_list":["post-587","post","type-post","status-publish","format-standard","hentry","category-linux","tag-hhvm"],"_links":{"self":[{"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=\/wp\/v2\/posts\/587","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=587"}],"version-history":[{"count":1,"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=\/wp\/v2\/posts\/587\/revisions"}],"predecessor-version":[{"id":588,"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=\/wp\/v2\/posts\/587\/revisions\/588"}],"wp:attachment":[{"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=587"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=587"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.siediyer.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=587"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}