{"id":16299,"date":"2023-11-04T20:03:21","date_gmt":"2023-11-04T12:03:21","guid":{"rendered":"https:\/\/www.linuxcool.com\/pmsdyypmsyym"},"modified":"2023-11-04T20:03:21","modified_gmt":"2023-11-04T12:03:21","slug":"pmsdyypmsyym","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/pmsdyypmsyym","title":{"rendered":"php\u2014cli\u6a21\u5f0f\u7684\u5e94\u7528php-cli\u6a21\u5f0f\u5e94\u7528\u6a21\u5f0f\u6a21\u5f0f"},"content":{"rendered":"<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>phpcli\u6a21\u5f0f\u5b66\u4e60(PHP<a style='color:#0000CC;font-size:16px' href='https:\/\/www.linuxcool.com\/' target='_blank' rel=\"noopener\">\u547d\u4ee4<\/a>\u884c\u6a21\u5f0f)<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u66f4\u65b0\u65f6\u95f4\uff1a2013\u5e7406\u670803\u65e516:23:28\u4f5c\u8005\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u4e4b\u524d\u6653\u5f97php\u2014cli\u6a21\u5f0f\u662f\u4e00\u79cd\u7c7b\u4f3cshell\u547d\u4ee4\u5f0f\u7684\u6267\u884cphp\u7a0b\u5e8f\uff0c\u4e0d\u8fc7\u4ecd\u7136\u4ee5\u4e3a\u8fd9\u4e2a\u662f\u4e00\u79cd\u843d\u540e\u7684\u65b9\u6cd5\uff0c\u5e94\u5f53\u6ca1\u6709\u54ea\u4e9b\u610f\u4e49\uff0c\u7531\u4e8e\u4ece\u6ca1\u6709\u78b0\u5230\u8fc7\u4f7f\u7528\u8fd9\u4e2acli\u6a21\u5f0f\u7f16\u7a0b\u7684\u3002\u4e0d\u8fc7\u6628\u5929\u9047\u89c1\u4e86\u4f7f\u7528cli\u6a21\u5f0f\u7684\u5e94\u7528<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>php_cli\u6a21\u5f0f\u7b80\u4ecb<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>php-cli\u662fphpCommandLineInterface\u7684\u7b80\u79f0\uff0c\u5c31\u50cf\u5b83\u540d\u5b50\u7684\u610f\u601d\uff0c\u5c31\u662fphp\u5728\u547d\u4ee4\u884c\u8fd0\u884c\u7684\u63d2\u53e3<strong>linux php \u547d\u4ee4\u884c\u53c2\u6570<\/strong>\uff0c\u533a\u522b\u4e8e\u5728Web\u670d\u52a1\u5668\u4e0a\u8fd0\u884c\u7684php\u73af\u5883\uff08php-cgi,isapi\u7b49\uff09\u4e5f\u5c31\u662f\u8bf4\uff0cphp\u4e0d\u5355\u53ef\u4ee5\u5199\u524d\u53f0\u7f51\u9875\uff0c\u5b83\u8fd8\u53ef\u4ee5\u62ff\u6765\u5199\u540e\u53f0\u7684\u7a0b\u5e8f\u3002PHP\u7684CLIshell\u811a\u672c\u9002\u7528\u4e8e\u6240\u6709\u7684PHP\u4f18\u52bf\uff0c\u4f7f\u521b\u5efa\u8981\u4e48\u652f\u6301\u811a\u672c\u6216<a style='color:#0000CC;font-size:16px' href='https:\/\/www.linuxdown.com\/' target='_blank' rel=\"noopener\">\u7cfb\u7edf<\/a>\u751a\u81f3\u4e0eGUI\u5e94\u7528\u7a0b\u5e8f\u7684\u670d\u52a1\u7aef\uff01\u2014\u2014\u6ce8\uff1awindows\u548clinux\u4e0b\u90fd\u652f\u6301php_cli\u6a21\u5f0f<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>PHP-cli\u5e94\u7528\u573a\u666f\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'><img style='max-height:500px;max-width:80%;margin: 10px auto' src='https:\/\/www.linuxcool.com\/wp-content\/uploads\/2023\/11\/1699099400880_0.png' alt='linux\u547d\u4ee4\u53c2\u6570\u7684\u5148\u540e\u987a\u5e8f_linux php \u547d\u4ee4\u884c\u53c2\u6570_linux\u547d\u4ee4\u53c2\u6570\u8bf4\u660e' \/><\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>1.\u591a\u7ebf\u7a0b\u5e94\u7528<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u8fd9\u65b9\u9762\u7684\u76ca\u5904\uff0c\u5f15\u7528\u9e1f\u54e5\u7684\u8bdd\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u4f18\u70b9:<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>1.\u4f7f\u7528\u591a\u8fdb\u7a0b,\u5b50\u8fdb\u7a0b\u7ed3\u675f\u4e4b\u540e,\u5185\u6838\u4f1a\u8d1f\u8d23\u56de\u6536\u8d44\u6e90<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>2.\u4f7f\u7528\u591a\u8fdb\u7a0b,\u5b50\u8fdb\u7a0b\u5f02\u5e38\u9000\u51fa\u4e0d\u4f1a\u9020\u6210\u6574\u4e2a\u8fdb\u7a0bThread\u9000\u51fa.\u7236\u8fdb\u7a0b\u8fd8\u6709\u673a\u4f1a\u91cd\u5efa\u6d41\u7a0b.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>3.\u4e00\u4e2a\u5e38\u9a7b\u4e3b\u8fdb\u7a0b,\u53ea\u8d1f\u8d23\u4efb\u52a1\u5206\u53d1,\u903b\u8f91\u66f4\u6e05\u695a.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>php\u7684\u591a\u7ebf\u7a0b\u2014\u6ca1\u9519\u5c31\u662fphp\u591a\u7ebf\u7a0b\u5e94\u7528\uff0c\u5373\u4f7f\u4f60\u4eec\u90fd\u666e\u904d\u89c9\u5f97php\u6ca1\u6709\u591a\u7ebf\u7a0b\uff08curl\u5c5e\u4e8e\u6a21\u62df\u591a\u7ebf\u7a0b\u800c\u4e0d\u662f\u771f\u5b9e\u7684\uff09\uff0c\u5e76\u4e14\u5728php_cli\u6a21\u5f0f\u4e0b\u7684php\u5f7b\u5e95\u7684\u662f\u5c5e\u4e8e\u591a\u7ebf\u7a0b\u3002\u8fd9\u4e2a\u65f6\u4fafphp\u5c5e\u4e8elinux\u7684\u4e00\u4e2a\u5b88\u62a4\u8fdb\u7a0b\u3002\u5728\u672c\u4eba\u4e4b\u524d\u5199\u8fc7\u7684\u300aPHP\u591a\u7ebf\u7a0b\u6279\u91cf\u91c7\u96c6\u4e0b\u8f7d\u7f8e\u7709\u56fe\u7247(\u7eed)\u300b\u7684\u65f6\u4faf\u5728\u91c7\u96c6\u7a0b\u5e8f\u91cc\u5373\u4f7f\u4f7f\u7528curl\u6765\u6a21\u62df\u591a\u7ebf\u7a0b\uff0c\u5e76\u4e14\u5728\u6d4f\u89c8\u5668\u6267\u884c\u7684\u65f6\u4faf\u4e5f\u662f\u4f1a\u78b0\u5230\u6267\u884c\u8d85\u65f6\u6216\u663e\u5b58abort\u800c\u9020\u6210\u7a0b\u5e8f\u4e2d\u65ad\uff0c\uff08\u8981\u5c1d\u8bd5\u51e0\u6b21\u624d\u53ef\u4ee5\u5f7b\u5e95\u6210\u529f\uff09\uff0c\u800c\u4e14\u5047\u5982\u5728php-cli\u6a21\u5f0f\u4e0b\u6267\u884clinux\u4f0a\u7538\u56ed\uff0c\u4f60\u90fd\u4f1a\u53d1\u89c9\u8fd9\u4e2a\u7a0b\u5e8f\u6267\u884c\u7684\u5f88\u5feb\uff0cphp\u591a\u7ebf\u7a0b\u6267\u884c\u7684\u4f18\u52bf\u88ab\u5f7b\u5e95\u8868\u73b0\u4e0b\u6765\u4e86.<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5907\u6ce8:\u8fd9\u4e9b\u591a\u7ebf\u7a0b\u5f62\u5f0f\u4e0d\u662f\u5f88\u6210\u719f\uff0c\u4e0d\u9002\u5b9c\u5927\u89c4\u6a21\u7684\u751f\u6210\u5e94\u7528\u7ea2\u65d7linux6.0\uff0c\u65f6\u5e38\u4f7f\u7528\u8fd8\u662f\u53ef\u4ee5\u7684<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>2.\u5b9a\u65f6\u6267\u884cphp\u7a0b\u5e8f<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u4e4b\u524d\u672c\u4eba\u603b\u7ed3\u5173\u4e8e\u300aPHP\u5b9a\u65f6\u6267\u884c\u8ba1\u5212\u4efb\u52a1\u300b\u7684\u4e09\u79cd\u5f62\u5f0f\uff0c\u501f\u52a9\u6709\u4e00\u5f20\u5c31\u662f\u501f\u52a9linux\u7684cron\u5f62\u5f0f\uff0c\u8fd9\u4e48\u8fd9\u4e2a\u65b9\u6cd5\u662f\u600e\u6837\u5b9a\u65f6\u6267\u884cphp\u7a0b\u5e8f\uff1f\u8bf7\u770b\u4e0b\u6587<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>3.\u5f00\u53d1\u684c\u9762\u7a0b\u5e8f<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u4f60\u53ef\u4ee5\u505a\u60a8\u7684Windows\u6216<a style='color:#0000CC;font-size:16px' href='https:\/\/www.linuxprobe.com\/' target='_blank' rel=\"noopener\">Linux<\/a>\u4e2d\u4f7f\u7528PHP\u7684\u56fe\u5f62\u7528\u6237\u754c\u9762\uff08GUI\uff09\u5e94\u7528\uff01\u6240\u6709\u4f60\u987b\u8981\u7684\u662fPHP\u7684\u547d\u4ee4\u884c\u63d2\u53e3\u548c\u4e00\u5305GTK\u3002\u8fd9\u5c06\u5bb9\u8bb8\u6784\u5efa\u771f\u6b63\u7684\u4fbf\u643a\u5f0f\u56fe\u5f62\u7528\u6237\u754c\u9762\u5e94\u7528\u7a0b\u5e8f\uff08\u5475\u5475\uff0c\u4e4b\u524d\u53ea\u662f\u6653\u5f97php\u53ef\u4ee5\u505a\u684c\u9762\u7a0b\u5e8f\uff0c\u5982\u4eca\u624d\u6653\u5f97\u662f\u4f7f\u7528php_cli\u6a21\u5f0f\uff09\uff0c\u4f46\u662f\u4e0d\u987b\u8981\u5b66\u4e60\u522b\u7684\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>4.\u7f16\u64b0PHP\u7684shell\u811a\u672c<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5047\u5982\u4f60\u4e0d\u4f1abashshell\u6216\u5219Perl\u7b49\u7684\u4f7f\u7528\uff0c\u800c\u4e14\u4f60\u53c8\u987b\u8981\u4e00\u4e9b\u811a\u672c\u53bb\u6267\u884c\u7684\u65f6\u4faf\uff0c\u5982\u4f55\u529e\uff1f\u8fd9\u4e2a\u65f6\u4faf\u4f60\u5b8c\u5168\u53ef\u4ee5\u4f7f\u7528\u4f60\u719f\u6089\u7684php\u7f16\u64b0shell\u811a\u672c\uff0c\u8fd9\u4e2a\u65f6\u4faf\u4f60\u662f\u4e0d\u662f\u5ffd\u7136\u89c9\u5f97PHP\u662f\u4e0d\u662f\u592a\u5f3a\u608d\u4e86\uff01\u2014\u2013\u771f\u6b63\u505a\u5230\u4e00\u79cd\u8bed\u8a00\uff0c\u56db\u5904\u5f00\u53d1\uff01<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>PHP_CLI\u4f7f\u7528\u65b9\u5f0f<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>win\u4e0b\u8fb9\u7684\u6267\u884c\u65b9\u5f0f\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5047\u5b9aphp.exe\u5728D:xamppphp\u5728dos\u547d\u4ee4\u5728\u53ef\u4ee5\u8fd9\u4e2a\u6267\u884c\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u590d\u5236\u4ee3\u7801\u4ee3\u7801\u5982\u4e0b:<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'><img style='max-height:500px;max-width:80%;margin: 10px auto' src='https:\/\/www.linuxcool.com\/wp-content\/uploads\/2023\/11\/1699099400880_1.png' alt='linux\u547d\u4ee4\u53c2\u6570\u7684\u5148\u540e\u987a\u5e8f_linux\u547d\u4ee4\u53c2\u6570\u8bf4\u660e_linux php \u547d\u4ee4\u884c\u53c2\u6570' \/><\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>D:xamppphpphp.exeD:xampphtdocstest.php<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5c31\u53ef\u4ee5\u6267\u884ctest.php\u8fd9\u4e2a\u6587\u4ef6\u4e86\u3002\u8fd9\u513f\u63a8\u8350win\u5e73\u53f0\u4e0bxampp\u96c6\u6210\u73af\u5883\uff0c\u771f\u6b63\u6bd4wamp\u5f3a\u608dN\u500d\uff0c\u8fd9\u4e2a\u96c6\u6210\u5305\u53ef\u4ee5\u76f4\u63a5\u6b65\u5165dos\u6a21\u5f0f\u3002<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>linux\u4e0bphp_cli\u4f7f\u7528<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u9996\u5148\u627e\u5230\u4f60\u5b89\u88c5php\u7684\u8def\u5f84<strong>linux php \u547d\u4ee4\u884c\u53c2\u6570<\/strong>\uff0c\u4ee5\u6211\u4e3a\u4f8b\uff1a<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>php\u5b89\u88c5\u5728\u8def\u5f84\/usr\/local\/php\/bin\/php\u4e0b<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u590d\u5236\u4ee3\u7801\u4ee3\u7801\u5982\u4e0b:<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\/usr\/local\/php\/bin\/php\/usr\/local\/apache\/htdocs\/a.php<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u5c31\u53ef\u4ee5\u6267\u884ca\u3002php\u6587\u4ef6<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>PHP_CLI\u7f16\u7a0b\u9700\u77e5<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u600e\u6837\u6d4b\u91cf\u73af\u5883\u652f\u6301php_cli\u6a21\u5f0f?<\/p>\n<p style='margin-bottom:16px;color:#555555;font-size:16px;line-height:200%;text-indent:2em'>\u590d\u5236\u4ee3\u7801\u4ee3\u7801\u5982\u4e0b:<\/p>\n","protected":false},"excerpt":{"rendered":"<p>cli\u6a21\u5f0f\u5b66\u4e60(PHP\u547d\u4ee4\u884c\u6a21\u5f0f)\u2014\u2014\u6ce8\uff1awindows\u548clinux\u4e0b\u90fd\u652f\u6301php_cli\u6a21\u5f0f\u8fd9\u4e2a\u65f6\u5019php\u5c5e\u4e8elinux\u7684\u4e00\u4e2a\u5b88\u62a4\u8fdb\u7a0b\u30022.\u5b9a\u65f6\u6267\u884cphp\u7a0b\u5e8flinux\u4e0bphp_cli\u4f7f\u7528php\u5b89\u88c5\u5728\u8def\u5f84\/usr\/local\/php\/bin\/php\u4e0b<\/p>\n","protected":false},"author":1,"featured_media":16300,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[273,46,235,274],"class_list":["post-16299","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-knowledge","tag-p-6","tag-s-2","tag-dxc","tag-bcyy"],"_links":{"self":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/16299","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/comments?post=16299"}],"version-history":[{"count":0,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/16299\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media\/16300"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=16299"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=16299"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=16299"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}