{"id":1037,"date":"2023-03-08T14:39:24","date_gmt":"2023-03-08T06:39:24","guid":{"rendered":"https:\/\/log.tanxiaodian.com\/?p=1037"},"modified":"2023-03-08T17:16:44","modified_gmt":"2023-03-08T09:16:44","slug":"%e5%ae%89%e8%a3%85swoole","status":"publish","type":"post","link":"https:\/\/log.tanxiaodian.com\/?p=1037","title":{"rendered":"\u5b89\u88c5swoole\u548cHyperf"},"content":{"rendered":"\n<p><strong>\u5b89\u88c5swoole<\/strong><\/p>\n\n\n\n<p>1\u3001\u4e0b\u8f7dphp\u7248\u672c\u5bf9\u5e94\u7684swoole \u6bd4\u5982swoole4.8\u9700\u8981  7.2\u4ee5\u4e0a\u7684PHP<\/p>\n\n\n\n<p>2\u3001\u5728swoole\u76ee\u5f55\u4e0b\u6267\u884c \u6b64\u7248\u672cphp\u7684phpize<\/p>\n\n\n\n<p>3\u3001\u6267\u884cconfigure  &#8211;with-php-config=\/usr\/local\/php\/bin\/php-config<\/p>\n\n\n\n<p>whereis php-config \u67e5\u8be2<\/p>\n\n\n\n<p>4\u3001make &amp;&amp; make install<\/p>\n\n\n\n<p>5\u3001php &#8211;ini \u627e\u5230\u76f8\u5e94\u7684php.ini\u6587\u4ef6 \u5199\u5165 extension=swoole.so<\/p>\n\n\n\n<p>6\u3001\u91cd\u65b0\u542f\u52a8php\u670d\u52a1<\/p>\n\n\n\n<p>7\u3001php -m  \u67e5\u770b\u6269\u5c55\u662f\u5426\u5df2\u5b89\u88c5\u6210\u529f<\/p>\n\n\n\n<p><strong>\u5b89\u88c5hyperf<\/strong><\/p>\n\n\n\n<p>\u4f7f\u7528composer\u5b89\u88c5<\/p>\n\n\n\n<p>\u547d\u4ee4\u4e3a:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>composer create-project hyperf\/hyperf-skeleton <\/code><\/pre>\n\n\n\n<p>\u9700\u8981\u6ce8\u610f\u63d0\u793acomposer\u9700\u8981\u5347\u7ea7,\u4e8e\u662f\u6211\u8fdb\u884c\u4e86\u5347\u7ea7:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">php -r \"copy('https:\/\/getcomposer.org\/installer', 'composer-setup.php');\"\nphp -r \"if (hash_file('sha384', 'composer-setup.php') === '55ce33d7678c5a611085589f1f3ddf8b3c52d662cd01d4ba75c0ee0459970c2200a51f492d557530c71c15d8dba01eae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;\"\nphp composer-setup.php\nphp -r \"unlink('composer-setup.php');\"<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">mv composer.phar \/usr\/local\/bin\/composer<\/pre>\n\n\n\n<p>composer &#8211;install-dir \/usr\/bin &#8211;filename composer<\/p>\n\n\n\n<p>\u5347\u7ea7\u5b8c\u6210<\/p>\n\n\n\n<p>\u91cd\u65b0\u6267\u884c\u521b\u5efa\u9879\u76ee\u547d\u4ee4<\/p>\n\n\n\n<p>\u751f\u6210\u4e86hyperf\u6846\u67b6\u76ee\u5f55<\/p>\n\n\n\n<p>\u8fdb\u5165\u9879\u76ee\u76ee\u5f55\u8fd0\u884chyperf:<\/p>\n\n\n\n<p>php bin\/hyperf.php start<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" width=\"918\" height=\"189\" src=\"https:\/\/log.tanxiaodian.com\/wp-content\/uploads\/2023\/03\/image-1.png\" alt=\"\" class=\"wp-image-1044\" srcset=\"https:\/\/log.tanxiaodian.com\/wp-content\/uploads\/2023\/03\/image-1.png 918w, https:\/\/log.tanxiaodian.com\/wp-content\/uploads\/2023\/03\/image-1-300x62.png 300w, https:\/\/log.tanxiaodian.com\/wp-content\/uploads\/2023\/03\/image-1-768x158.png 768w\" sizes=\"(max-width: 918px) 100vw, 918px\" \/><\/figure>\n\n\n\n<p>\u5982\u679c\u51fa\u73b0\u5982\u4e0b\u753b\u9762\u5219hyperf\u7a0b\u5e8f\u5df2\u7ecf\u6b63\u5e38\u8fd0\u884c\u4e86<\/p>\n\n\n\n<p>\u8fdb\u884c\u6d4b\u8bd5<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" width=\"499\" height=\"48\" src=\"https:\/\/log.tanxiaodian.com\/wp-content\/uploads\/2023\/03\/image-2.png\" alt=\"\" class=\"wp-image-1045\" srcset=\"https:\/\/log.tanxiaodian.com\/wp-content\/uploads\/2023\/03\/image-2.png 499w, https:\/\/log.tanxiaodian.com\/wp-content\/uploads\/2023\/03\/image-2-300x29.png 300w\" sizes=\"(max-width: 499px) 100vw, 499px\" \/><\/figure>\n\n\n\n<p>\u5b8c\u6210<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b89\u88c5swoole 1\u3001\u4e0b\u8f7dphp\u7248\u672c\u5bf9\u5e94\u7684swoo&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/log.tanxiaodian.com\/?p=1037\">Continue reading<span class=\"screen-reader-text\">\u5b89\u88c5swoole\u548cHyperf<\/span><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[196],"_links":{"self":[{"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=\/wp\/v2\/posts\/1037"}],"collection":[{"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1037"}],"version-history":[{"count":2,"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=\/wp\/v2\/posts\/1037\/revisions"}],"predecessor-version":[{"id":1046,"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=\/wp\/v2\/posts\/1037\/revisions\/1046"}],"wp:attachment":[{"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1037"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1037"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/log.tanxiaodian.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1037"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}