{"id":1388,"date":"2020-03-17T23:58:22","date_gmt":"2020-03-17T15:58:22","guid":{"rendered":"http:\/\/blog.coolcoding.cn\/?p=1388"},"modified":"2020-03-18T00:00:01","modified_gmt":"2020-03-17T16:00:01","slug":"centos7-php%e5%86%85%e5%ad%98%e4%bc%98%e5%8c%96","status":"publish","type":"post","link":"https:\/\/blog.coolcoding.cn\/?p=1388","title":{"rendered":"centos7-php\u5185\u5b58\u4f18\u5316"},"content":{"rendered":"\n<p>\u914d\u7f6e\u6587\u4ef6\uff1a \/etc\/php-fpm.d\/www.conf<\/p>\n\n\n\n<p> pm\u4e09\u79cd\u8fdb\u7a0b\u7ba1\u7406\u6a21\u5f0f\u8bf4\u660e\u5982\u4e0b\uff1a <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pm = static\uff0c\u59cb\u7ec8\u4fdd\u6301\u4e00\u4e2a\u56fa\u5b9a\u6570\u91cf\u7684\u5b50\u8fdb\u7a0b\uff0c\u8fd9\u4e2a\u6570\u7531pm.max_children\u5b9a\u4e49\uff0c\u8fd9\u79cd\u65b9\u5f0f\u5f88\u4e0d\u7075\u6d3b\uff0c\u4e5f\u901a\u5e38\u4e0d\u662f\u9ed8\u8ba4\u7684\u3002\n\npm = dynamic\uff0c\u542f\u52a8\u65f6\u4f1a\u4ea7\u751f\u56fa\u5b9a\u6570\u91cf\u7684\u5b50\u8fdb\u7a0b\uff08\u7531pm.start_servers\u63a7\u5236\uff09\u53ef\u4ee5\u7406\u89e3\u6210\u6700\u5c0f\u5b50\u8fdb\u7a0b\u6570\uff0c\u800c\u6700\u5927\u5b50\u8fdb\u7a0b\u6570\u5219\u7531pm.max_children\u53bb\u63a7\u5236\uff0c\u5b50\u8fdb\u7a0b\u6570\u4f1a\u5728\u6700\u5927\u548c\u6700\u5c0f\u6570\u8303\u56f4\u4e2d\u53d8\u5316\u3002\u95f2\u7f6e\u7684\u5b50\u8fdb\u7a0b\u6570\u8fd8\u53ef\u4ee5\u7531\u53e62\u4e2a\u914d\u7f6e\u63a7\u5236\uff0c\u5206\u522b\u662fpm.min_spare_servers\u548cpm.max_spare_servers\u3002\u5982\u679c\u95f2\u7f6e\u7684\u5b50\u8fdb\u7a0b\u8d85\u51fa\u4e86pm.max_spare_servers\uff0c\u5219\u4f1a\u88ab\u6740\u6389\u3002\u5c0f\u4e8epm.min_spare_servers\u5219\u4f1a\u542f\u52a8\u8fdb\u7a0b\uff08\u6ce8\u610f\uff0cpm.max_spare_servers\u5e94\u5c0f\u4e8epm.max_children\uff09\u3002\n\npm = ondemand\uff0c\u8fd9\u79cd\u6a21\u5f0f\u548cpm = dynamic\u76f8\u53cd\uff0c\u628a\u5185\u5b58\u653e\u5728\u7b2c\u4e00\u4f4d\uff0c\u6bcf\u4e2a\u95f2\u7f6e\u8fdb\u7a0b\u5728\u6301\u7eed\u95f2\u7f6e\u4e86pm.process_idle_timeout\u79d2\u540e\u5c31\u4f1a\u88ab\u6740\u6389\uff0c\u5982\u679c\u670d\u52a1\u5668\u957f\u65f6\u95f4\u6ca1\u6709\u8bf7\u6c42\uff0c\u5c31\u53ea\u4f1a\u6709\u4e00\u4e2aphp-fpm\u4e3b\u8fdb\u7a0b\u3002\u5f0a\u7aef\u662f\u9047\u5230\u9ad8\u5cf0\u671f\u6216\u8005\u5982\u679cpm.process_idle_timeout\u7684\u503c\u592a\u77ed\u7684\u8bdd\uff0c\u5bb9\u6613\u51fa\u73b0504 Gateway Time-out\u9519\u8bef\uff0c\u56e0\u6b64pm = dynamic\u548cpm = ondemand\u8c01\u66f4\u9002\u5408\u89c6\u5b9e\u9645\u60c5\u51b5\u800c\u5b9a\u3002<\/code><\/pre>\n\n\n\n<p>static\u7ba1\u7406\u6a21\u5f0f\u9002\u5408\u6bd4\u8f83\u5927\u5185\u5b58\u7684\u670d\u52a1\u5668\uff0c<\/p>\n\n\n\n<p>dynamic\u5219\u9002\u5408\u5c0f\u5185\u5b58\u7684\u670d\u52a1\u5668\uff0c\u53ef\u4ee5\u8bbe\u7f6e\u4e00\u4e2apm.min_spare_servers\u548cpm.max_spare_servers\u5408\u7406\u8303\u56f4\uff0c\u8fd9\u6837\u8fdb\u7a0b\u6570\u4f1a\u4e0d\u65ad\u53d8\u52a8\u3002<\/p>\n\n\n\n<p>ondemand\u6a21\u5f0f\u5219\u66f4\u52a0\u9002\u5408\u5fae\u5c0f\u5185\u5b58\uff0c\u4f8b\u5982512MB\u6216\u8005256MB\u5185\u5b58\uff0c\u4ee5\u53ca\u5bf9\u53ef\u7528\u6027\u8981\u6c42\u4e0d\u9ad8\u7684\u73af\u5883\u3002<\/p>\n\n\n\n<p>service php-fpm restart<br>echo 1 > \/proc\/sys\/vm\/drop_caches <\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u914d\u7f6e\u6587\u4ef6\uff1a \/etc\/php-fpm.d\/www.conf pm\u4e09\u79cd\u8fdb\u7a0b\u7ba1\u7406\u6a21\u5f0f\u8bf4\u660e\u5982\u4e0b\uff1a static\u7ba1\u7406\u6a21 [&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":[],"_links":{"self":[{"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts\/1388"}],"collection":[{"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1388"}],"version-history":[{"count":2,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts\/1388\/revisions"}],"predecessor-version":[{"id":1390,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts\/1388\/revisions\/1390"}],"wp:attachment":[{"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1388"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1388"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1388"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}