{"id":200914,"date":"2025-05-06T10:18:45","date_gmt":"2025-05-06T02:18:45","guid":{"rendered":"https:\/\/server.hk\/cnblog\/200914\/"},"modified":"2025-05-06T10:18:45","modified_gmt":"2025-05-06T02:18:45","slug":"php%e8%84%9a%e6%9c%ac%e5%8f%8d%e5%a4%8d%e5%87%ba%e7%8e%b0send-of-xxx-bytes-failed-with-errno32-broken-pipe%e9%94%99%e8%af%af%e6%80%8e%e4%b9%88%e5%8a%9e%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/200914\/","title":{"rendered":"PHP\u811a\u672c\u53cd\u590d\u51fa\u73b0\u201csend of xxx bytes failed with errno=32 Broken pipe\u201d\u9519\u8bef\u600e\u4e48\u529e\uff1f"},"content":{"rendered":"<p><b><\/b> <\/p>\n<h1>PHP\u811a\u672c\u53cd\u590d\u51fa\u73b0\u201csend of xxx bytes failed with errno=32 Broken pipe\u201d\u9519\u8bef\u600e\u4e48\u529e\uff1f<\/h1>\n<p>\u5bf9\u4e8e\u4e00\u4e2a\u6570\u636e\u5e93\u5f00\u53d1\u8005\u6765\u8bf4\uff0c\u7262\u56fa\u624e\u5b9e\u7684\u57fa\u7840\u662f\u5341\u5206\u91cd\u8981\u7684\uff0c\u4e3b\u673a\u5b9d\u8d1d\u5c31\u6765\u5e26\u5927\u5bb6\u4e00\u70b9\u70b9\u7684\u638c\u63e1\u57fa\u7840\u77e5\u8bc6\u70b9\u3002\u4eca\u5929\u672c\u7bc7\u6587\u7ae0\u5e26\u5927\u5bb6\u4e86\u89e3\u300aPHP\u811a\u672c\u53cd\u590d\u51fa\u73b0\u201csend of xxx bytes failed with errno=32 Broken pipe\u201d\u9519\u8bef\u600e\u4e48\u529e\uff1f\u300b\uff0c\u4e3b\u8981\u4ecb\u7ecd\u4e86\uff0c\u5e0c\u671b\u5bf9\u5927\u5bb6\u7684\u77e5\u8bc6\u79ef\u7d2f\u6709\u6240\u5e2e\u52a9\uff0c\u5feb\u70b9\u6536\u85cf\u8d77\u6765\u5427\uff0c\u5426\u5219\u9700\u8981\u65f6\u5c31\u627e\u4e0d\u5230\u4e86\uff01<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241120\/1732086217673d89c9a0af3.jpg\" class=\"aligncenter\"><\/p>\n<p><strong>php\u811a\u672c\u53cd\u590d\u51fa\u73b0\u201csend of xxx bytes failed with errno=32 broken pipe\u201d\u9519\u8bef<\/strong><\/p>\n<p>\u5728\u4f7f\u7528php\u811a\u672c\u65f6\uff0c\u7ecf\u5e38\u4f1a\u9047\u5230\u7c7b\u4f3c\u201cmysqli_query(): send of 309 bytes failed with errno=32 broken pipe\u201d\u8fd9\u6837\u7684\u9519\u8bef\u3002\u867d\u7136\u6709\u4eba\u5efa\u8bae\u901a\u8fc7\u8bbe\u7f6emax_allowed_packet\u6765\u89e3\u51b3\uff0c\u4f46\u5bf9\u4e8e\u6ca1\u6709\u8d85\u8fc7\u8be5\u8bbe\u7f6e\u503c\u7684\u60c5\u51b5\uff0c\u95ee\u9898\u53ef\u80fd\u53e6\u6709\u539f\u56e0\u3002<\/p>\n<p><strong>\u9519\u8bef\u539f\u56e0<\/strong><\/p>\n<p>broken pipe\u9519\u8bef\u901a\u5e38\u662f\u7531\u4e8ephp\u811a\u672c\u4e0emysql\u670d\u52a1\u5668\u4e4b\u95f4\u7684\u8fde\u63a5\u5728\u957f\u65f6\u95f4\u65e0\u64cd\u4f5c\u540e\u88ab\u670d\u52a1\u5668\u5173\u95ed\u5bfc\u81f4\u7684\u3002\u5f53\u811a\u672c\u518d\u6b21\u5c1d\u8bd5\u901a\u8fc7\u8be5\u5df2\u5173\u95ed\u8fde\u63a5\u6267\u884c\u67e5\u8be2\u65f6\uff0c\u5c31\u4f1a\u51fa\u73b0\u8be5\u9519\u8bef\u3002<\/p>\n<p><strong>\u89e3\u51b3\u65b9\u6848<\/strong><\/p>\n<p>\u8981\u89e3\u51b3\u6b64\u95ee\u9898\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u4ee5\u4e0b\u65b9\u6cd5\uff1a<\/p>\n<ul>\n<li>\n<p><strong>\u8c03\u6574mysql\u670d\u52a1\u5668\u7684wait_timeout\u53c2\u6570\uff1a<\/strong>\u8be5\u53c2\u6570\u51b3\u5b9a\u4e86\u975e\u4ea4\u4e92\u5f0f\u8fde\u63a5\u5728\u65e0\u6d3b\u52a8\u540e\u591a\u4e45\u4f1a\u88ab\u5173\u95ed\u3002\u6839\u636e\u9700\u8981\u5c06\u5176\u8bbe\u7f6e\u5f97\u66f4\u5927\uff0c\u4f8b\u5982\uff1a<\/p>\n<pre>if (!mysqli_ping($conn)) {\n    \/\/ \u65ad\u5f00\u8fde\u63a5\n    mysqli_close($conn);\n\n    \/\/ \u91cd\u65b0\u8fde\u63a5\n    $conn = mysqli_connect($host, $user, $password, $database);\n}<\/pre>\n<p>\u6ce8\u610f\uff0c\u9700\u8981\u4f7f\u7528\u81ea\u5df1\u7684\u6570\u636e\u5e93\u8fde\u63a5\u4fe1\u606f\u66ff\u6362 $host\u3001$user\u3001$password \u548c $database \u53d8\u91cf\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u901a\u8fc7\u8c03\u6574\u8fd9\u4e9b\u8bbe\u7f6e\uff0c\u53ef\u4ee5\u5728\u907f\u514d\u9047\u5230 broken pipe \u9519\u8bef\u3002<\/p>\n<p>\u7406\u8bba\u8981\u638c\u63e1\uff0c\u5b9e\u64cd\u4e0d\u80fd\u843d\uff01\u4ee5\u4e0a\u5173\u4e8e\u300aPHP\u811a\u672c\u53cd\u590d\u51fa\u73b0\u201csend of xxx bytes failed with errno=32 Broken pipe\u201d\u9519\u8bef\u600e\u4e48\u529e\uff1f\u300b\u7684\u8be6\u7ec6\u4ecb\u7ecd\uff0c\u5927\u5bb6\u90fd\u638c\u63e1\u4e86\u5427\uff01\u5982\u679c\u60f3\u8981\u7ee7\u7eed\u63d0\u5347\u81ea\u5df1\u7684\u80fd\u529b\uff0c\u90a3\u4e48\u5c31\u6765\u5173\u6ce8\u4e3b\u673a\u5b9d\u8d1d\u516c\u4f17\u53f7\u5427\uff01<\/p>\n<dl>\n<dt>\n <\/dt>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>PHP\u811a\u672c\u53cd\u590d\u51fa\u73b0\u201csend o&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-200914","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/200914","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=200914"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/200914\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=200914"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=200914"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=200914"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}