{"id":77,"date":"2011-02-03T15:57:23","date_gmt":"2011-02-03T15:57:23","guid":{"rendered":"http:\/\/hgtas.com\/?p=77"},"modified":"2011-02-03T15:57:23","modified_gmt":"2011-02-03T15:57:23","slug":"php-ini-under-the-optimal-allocation-of-centos-with-the-cms-program-efficiency","status":"publish","type":"post","link":"https:\/\/508.me\/?p=77","title":{"rendered":"CentOS\u4e0bphp.ini\u7684\u4f18\u5316\u914d\u7f6e\u4e0eCMS\u7a0b\u5e8f\u6548\u7387"},"content":{"rendered":"<p>\u505a\u8fc7CMS\u7684\u5f00\u53d1\u8005\u90fd\u77e5\u9053\uff0c\u5728LAMP\u73af\u5883\u4e0b\u8fdb\u884c\u540e\u53f0\u767b\u9646\u548c\u4e0a\u4f20\u6587\u4ef6\uff0c\u662f\u5f88\u5bb9\u6613\u51fa\u73b0\u95ee\u9898\u7684\u4e24\u4e2a\u5730\u65b9\uff0c\u5e76\u4e14\u5927\u591a\u662f\u7531\u4e8ePHP\u914d\u7f6e\u95ee\u9898\uff0c\u6240\u4ee5\u505a\u597dPHP\u4f18\u5316\u81f3\u5173\u91cd\u8981\u3002\u5bf9\u4e8ePHP\u7684\u4f18\u5316\uff0c\u4e3b\u8981\u662f\u5bf9php.ini\u4e2d\u7684\u76f8\u5173\u4e3b\u8981\u53c2\u6570\u8fdb\u884c\u5408\u7406\u8c03\u6574\u548c\u8bbe\u7f6e\uff0c\u4ee5\u4e0b\u6211\u4eec\u5c31\u6765\u770b\u770bphp.ini\u4e2d\u7684\u4e00\u4e9b\u5bf9\u6027\u80fd\u5f71\u54cd\u8f83\u5927\u7684\u53c2\u6570\u5e94\u8be5\u5982\u4f55\u8bbe\u7f6e(\u7cfb\u7edf\u4e3aCentOS)\u3002<\/p>\n<p>(1) PHP\u51fd\u6570\u7981\u7528\u627e\u5230<\/p>\n<p>disable_functions =<\/p>\n<p>\u8be5\u9009\u9879\u53ef\u4ee5\u8bbe\u7f6e\u54ea\u4e9bPHP\u51fd\u6570\u662f\u7981\u6b62\u4f7f\u7528\u7684,PHP\u4e2d\u6709\u4e00\u4e9b\u51fd\u6570\u7684\u98ce\u9669\u6027\u8fd8\u662f\u76f8\u5f53\u5927\u7684,\u53ef\u4ee5\u76f4\u63a5\u6267\u884c\u4e00\u4e9bCentOS\u7cfb\u7edf\u7ea7\u811a\u672c\u547d\u4ee4,\u5982\u679c\u5141\u8bb8\u8fd9\u4e9b\u51fd\u6570\u6267\u884c,\u5f53PHP \u7a0b\u5e8f\u51fa\u73b0\u6f0f\u6d1e\u65f6,\u635f\u5931\u662f\u975e\u5e38\u4e25\u91cd\u7684!\u4ee5\u4e0b\u6211\u4eec\u7ed9\u51fa\u63a8\u8350\u7684\u7981\u7528\u51fd\u6570\u8bbe\u7f6e:<\/p>\n<p>disable_functions = phpinfo,passthru,exec,system,popen,chroot,escapeshellcmd,escapeshellarg,shell_exec,proc_open,proc_get_status<\/p>\n<p>\u9700\u6ce8\u610f:\u5982\u679c\u60a8\u7684\u670d\u52a1\u5668\u4e2d\u542b\u6709\u4e00\u4e9bCentOS\u7cfb\u7edf\u72b6\u6001\u68c0\u6d4b\u7684PHP\u7a0b\u5e8f,\u5219\u4e0d\u8981\u7981\u7528shell_exec,proc_open,proc_get_status\u7b49\u51fd\u6570\u3002<\/p>\n<p><!--more--><\/p>\n<p>(2) PHP\u811a\u672c\u6267\u884c\u65f6\u95f4\u627e\u5230<\/p>\n<p>max_execution_time = 30<\/p>\n<p>\u8be5\u9009\u9879\u8bbe\u5b9aPHP\u7a0b\u5e8f\u7684\u6700\u5927\u6267\u884c\u65f6\u95f4,\u5982\u679c\u4e00\u4e2aPHP\u811a\u672c\u88ab\u8bf7\u6c42,\u4e14\u8be5PHP\u811a\u672c\u5728max_execution_time\u65f6\u95f4\u5185\u6ca1\u80fd\u6267\u884c\u5b8c\u6bd5,\u5219PHP\u4e0d\u518d\u7ee7\u7eed\u6267\u884c,\u76f4\u63a5\u7ed9\u5ba2\u6237\u7aef\u8fd4\u56de\u8d85\u65f6\u9519\u8bef\u3002\u6ca1\u6709\u7279\u6b8a\u9700\u8981\u8be5\u9009\u9879\u53ef\u4fdd\u6301\u9ed8\u8ba4\u8bbe\u7f6e30\u79d2,\u5982\u679c\u60a8\u7684PHP\u811a\u672c\u786e\u5b9e\u9700\u8981\u957f\u6267\u884c\u65f6\u95f4\u5219\u53ef\u4ee5\u9002\u5f53\u589e\u5927\u8be5\u65f6\u95f4\u8bbe\u7f6e\u3002<\/p>\n<p>(3) PHP\u811a\u672c\u5904\u7406\u5185\u5b58\u5360\u7528\u627e\u5230<\/p>\n<p>memory_limit = 8M<\/p>\n<p>\u8be5\u9009\u9879\u6307\u5b9aPHP\u811a\u672c\u5904\u7406\u6240\u80fd\u5360\u7528\u7684\u6700\u5927\u5185\u5b58,\u9ed8\u8ba4\u4e3a8MB,\u5982\u679c\u60a8\u7684\u670d\u52a1\u5668\u5185\u5b58\u4e3a1GB\u4ee5\u4e0a,\u5219\u8be5\u9009\u9879\u53ef\u4ee5\u8bbe\u7f6e\u4e3a12MB\u4ee5\u83b7\u5f97\u66f4\u5feb\u7684PHP\u811a\u672c\u5904\u7406\u6548\u7387\u3002<\/p>\n<p>(4) PHP\u5168\u5c40\u51fd\u6570\u58f0\u660e\u627e\u5230<\/p>\n<p>register_globals = Off<\/p>\n<p>\u7f51\u7edc\u4e0a\u5f88\u591a\u5173\u4e8ePHP\u8bbe\u7f6e\u7684\u6587\u7ae0\u90fd\u63a8\u8350\u5c06\u8be5\u9009\u9879\u8bbe\u7f6e\u4e3aOn,\u5176\u5b9e\u8fd9\u662f\u4e00\u79cd\u53ca\u5176\u5371\u9669\u7684\u8bbe\u7f6e\u65b9\u6cd5,\u5f88\u53ef\u80fd\u5f15\u8d77\u4e25\u91cd\u7684\u5b89\u5168\u6027\u95ee\u9898\u3002\u5982\u679c\u6ca1\u6709\u7279\u6b8a\u7684\u9700\u8981,\u5f3a\u70c8\u63a8\u8350\u4fdd\u7559\u9ed8\u8ba4\u8bbe\u7f6e!<\/p>\n<p>(5) PHP\u4e0a\u4f20\u6587\u4ef6\u5927\u5c0f\u9650\u5236\u627e\u5230<\/p>\n<p>upload_max_filesize = 2M<\/p>\n<p>\u8be5\u9009\u9879\u8bbe\u5b9aPHP\u6240\u80fd\u5141\u8bb8\u6700\u5927\u4e0a\u4f20\u6587\u4ef6\u5927\u5c0f,\u9ed8\u8ba4\u4e3a2MB\u3002\u6839\u636e\u5b9e\u9645\u5e94\u7528\u9700\u6c42,\u53ef\u4ee5\u9002\u5f53\u589e\u5927\u8be5\u8bbe\u7f6e\u3002<\/p>\n<p>(6) Session\u5b58\u50a8\u4ecb\u8d28\u627e\u5230<\/p>\n<p>session.save_path<\/p>\n<p>\u5982\u679c\u4f60\u7684PHP\u7a0b\u5e8f\u4f7f\u7528Session\u5bf9\u8bdd,\u5219\u53ef\u4ee5\u5c06Session\u5b58\u50a8\u4f4d\u7f6e\u8bbe\u7f6e\u4e3a\/dev\/shm,\/dev\/shm\u662fLinux\u7cfb\u7edf\u72ec\u6709\u7684TMPFS \u6587\u4ef6\u7cfb\u7edf,\u662f\u4ee5\u5185\u5b58\u4e3a\u4e3b\u8981\u5b58\u50a8\u65b9\u5f0f\u7684\u6587\u4ef6\u7cfb\u7edf,\u6bd4RAMDISK\u66f4\u4f18\u79c0,\u56e0\u4e3a\u53ef\u4ee5\u4f7f\u7528DISKSWAP\u4f5c\u4e3a\u8865\u5145,\u800c\u4e14\u662fCentOS\u7cfb\u7edf\u81ea\u5e26\u7684\u529f\u80fd\u6a21\u5757,\u4e0d\u9700\u8981\u53e6\u884c\u914d\u7f6e\u3002\u60f3\u60f3\u770b,\u4ece\u78c1\u76d8IO\u64cd\u4f5c\u5230\u5185\u5b58\u64cd\u4f5c,\u901f\u5ea6\u4f1a\u5feb\u591a\u5c11?\u53ea\u662f\u9700\u8981\u6ce8\u610f,\u5b58\u50a8\u5728\/dev\/shm\u7684\u6570\u636e,\u5728\u670d\u52a1\u5668\u91cd\u542f\u540e\u4f1a\u5168\u90e8\u4e22\u5931\u3002\u4e0d\u8fc7\u8fd9\u5bf9\u4e8e Session\u6765\u8bf4\u662f\u65e0\u8db3\u8f7b\u91cd\u7684\u3002\u8fd9\u6837\u6211\u4eec\u5c31\u5b8c\u6210\u4e86\u5728CentOS\u7cfb\u7edfPHP\u4f18\u5316\u7684\u6b65\u9aa4\u3002<\/p>\n<p><a href=\"http:\/\/www.dustk.com\/archives\/12.html\">http:\/\/www.dustk.com\/archives\/12.html<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u505a\u8fc7CMS\u7684\u5f00\u53d1\u8005\u90fd\u77e5\u9053\uff0c\u5728LAMP\u73af\u5883\u4e0b\u8fdb\u884c\u540e\u53f0\u767b\u9646\u548c\u4e0a\u4f20\u6587\u4ef6\uff0c\u662f\u5f88\u5bb9\u6613\u51fa\u73b0\u95ee\u9898\u7684\u4e24\u4e2a\u5730\u65b9\uff0c\u5e76\u4e14\u5927\u591a\u662f\u7531\u4e8eP [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[17],"tags":[38,140,40,39],"_links":{"self":[{"href":"https:\/\/508.me\/index.php?rest_route=\/wp\/v2\/posts\/77"}],"collection":[{"href":"https:\/\/508.me\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/508.me\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/508.me\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/508.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=77"}],"version-history":[{"count":2,"href":"https:\/\/508.me\/index.php?rest_route=\/wp\/v2\/posts\/77\/revisions"}],"predecessor-version":[{"id":79,"href":"https:\/\/508.me\/index.php?rest_route=\/wp\/v2\/posts\/77\/revisions\/79"}],"wp:attachment":[{"href":"https:\/\/508.me\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=77"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/508.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=77"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/508.me\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=77"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}