{"id":26446,"date":"2024-11-24T17:11:55","date_gmt":"2024-11-24T09:11:55","guid":{"rendered":"https:\/\/fwq.ai\/blog\/26446\/"},"modified":"2024-11-24T17:11:55","modified_gmt":"2024-11-24T09:11:55","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-2","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/26446\/","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><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173094948548936.jpg\" class=\"aligncenter\" title=\"PHP\u811a\u672c\u53cd\u590d\u51fa\u73b0\u201csend of xxx bytes failed with errno=32 Broken pipe\u201d\u9519\u8bef\u600e\u4e48\u529e\uff1f\u63d2\u56fe\" alt=\"PHP\u811a\u672c\u53cd\u590d\u51fa\u73b0\u201csend of xxx bytes failed with errno=32 Broken pipe\u201d\u9519\u8bef\u600e\u4e48\u529e\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u53cd\u590d\u51fa\u73b0\u201csend of xxx bytes fled 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\u201ci_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><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/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> \u767b\u5f55\u540e\u590d\u5236 <\/p>\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>\u4ee5\u4e0a\u5c31\u662fPHP\u811a\u672c\u53cd\u590d\u51fa\u73b0\u201csend of xxx bytes fled with errno=32 Broken pipe\u201d\u9519\u8bef\u600e\u4e48\u529e\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u53cd\u590d\u51fa\u73b0\u201csend of xxx bytes fled with errno=32 broken pipe\u201d\u9519\u8bef \u5728\u4f7f\u7528php\u811a\u672c\u65f6\uff0c\u7ecf\u5e38\u4f1a\u9047\u5230\u7c7b\u4f3c\u201ci_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 \u9519\u8bef\u539f\u56e0 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 \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b \u89e3\u51b3\u65b9\u6848 \u8981\u89e3\u51b3\u6b64\u95ee\u9898\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u4ee5\u4e0b\u65b9\u6cd5\uff1a \u8c03\u6574mysql\u670d\u52a1\u5668\u7684wait_timeout\u53c2\u6570\uff1a\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 if (!mysqli_ping($conn)) { \/\/ \u65ad\u5f00\u8fde\u63a5 mysqli_close($conn); \/\/ \u91cd\u65b0\u8fde\u63a5 $conn = mysqli_connect($host, $user, $password, $database); } \u767b\u5f55\u540e\u590d\u5236 \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 \u901a\u8fc7\u8c03\u6574\u8fd9\u4e9b\u8bbe\u7f6e\uff0c\u53ef\u4ee5\u5728\u907f\u514d\u9047\u5230 broken pipe \u9519\u8bef\u3002 \u4ee5\u4e0a\u5c31\u662fPHP\u811a\u672c\u53cd\u590d\u51fa\u73b0\u201csend of xxx bytes [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-26446","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/26446","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=26446"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/26446\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=26446"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=26446"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=26446"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}