{"id":53,"date":"2023-06-05T12:59:56","date_gmt":"2023-06-05T04:59:56","guid":{"rendered":"http:\/\/pro369.com\/linux\/?p=53"},"modified":"2019-08-02T00:59:00","modified_gmt":"2019-08-01T16:59:00","slug":"%e3%80%90php%e7%b6%b2%e9%a0%81%e9%96%8b%e5%95%9f%e9%8c%af%e8%aa%a4%e7%9a%84%e8%a7%a3%e6%b1%ba%e6%96%b9%e6%b3%95%e3%80%91fatal-error-allowed-memory-size-of-16777216-bytes-exhausted-tried-to-alloc","status":"publish","type":"post","link":"https:\/\/por.tw\/linux\/%e3%80%90php%e7%b6%b2%e9%a0%81%e9%96%8b%e5%95%9f%e9%8c%af%e8%aa%a4%e7%9a%84%e8%a7%a3%e6%b1%ba%e6%96%b9%e6%b3%95%e3%80%91fatal-error-allowed-memory-size-of-16777216-bytes-exhausted-tried-to-alloc\/","title":{"rendered":"\u3010PHP\u7db2\u9801\u958b\u555f\u932f\u8aa4\u7684\u89e3\u6c7a\u65b9\u6cd5\u3011Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 7905 bytes) in"},"content":{"rendered":"<p><span style=\"background-color: #ffff00; font-size: medium;\"><strong>\u3010PHP\u7db2\u9801\u958b\u555f\u932f\u8aa4\u7684\u89e3\u6c7a\u65b9\u6cd5\u3011Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 7905 bytes) in <\/strong><\/span><\/p>\n<p><span style=\"color: #ff0000; font-size: medium;\"><strong>\u7e3d\u6559\u982d\u60a8\u597d\uff1a<\/strong><\/span><br \/>\n<strong>\u6211\u7db2\u7ad9\u67b6\u8a2d\u5f8c\uff0c\u51fa\u73fe\uff1aFatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 7905 bytes) in<\/strong><\/p>\n<p><strong>PHP\u7db2\u9801\u958b\u555f\u932f\u8aa4\uff08\u7121\u6cd5\u6b63\u78ba\u986f\u793a\uff09<\/strong><\/p>\n<p><strong>\u8acb\u554f\u7e3d\u6559\u982d\u6211\u8a72\u5982\u4f55\u8655\u7406\uff1f<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/visdacom.com\/linux\/wp-content\/uploads\/2019\/08\/Linux-Server-Project-8-650x433.jpg\" alt=\"\" class=\"alignnone size-medium wp-image-495\" width=\"650\" height=\"433\" \/><\/p>\n<p><\/strong><\/p>\n<p><span style=\"font-size: medium;\"><strong><span style=\"color: #0000ff;\">\u7e3d\u6559\u982d\u56de\u8986\uff1a<\/span><br \/>\n\u539f\u56e0\uff1a<\/strong><\/span><span style=\"font-size: medium;\"><strong>\u5bb9\u8a31\u8a18\u61b6\u9ad4\u5927\u5c0f\u932f\u8aa4\uff08\u5bb9\u8a31\u8a18\u61b6\u9ad4\u4e0d\u5920\u5927\uff09\u6240\u7522\u751f\u7684<\/strong><\/span><span style=\"font-size: medium;\"><strong>\u932f\u8aa4<\/strong><\/span><br \/>\n<span style=\"font-size: medium;\"><strong>\u81f4\u547d\u932f\u8aa4\uff1a\u5bb9\u8a31\u8a18\u61b6\u9ad4\u5927\u5c0fXXXXXXXX\u4f4d\u5143\u7d44\u7528\u76e1\uff08\u5617\u8a66\u914d\u7f6eXXXX\u4f4d\u5143\u7d44\uff09<\/strong><\/span><\/p>\n<p><span style=\"font-size: medium;\"><strong><span style=\"background-color: #ffff00;\">\u89e3\u6c7a\u65b9\u6cd5\uff0c\u5982\u4e0b\uff1a<\/span><\/strong><\/span><\/p>\n<p><span style=\"color: #008080; font-size: medium;\"><strong>1.\u8acb\u4fee\u6539\u4fee\u6539 php.ini<\/strong><\/span><\/p>\n<p><span style=\"color: #800000;\"><strong>php.ini\u5728Linux\u4e3b\u6a5f\u4e0b\u7684\u8def\u5f91\uff1a<\/strong><\/span><\/p>\n<p>\/etc\/php5\/apache2\/php.ini<\/p>\n<p><span style=\"color: #800080; font-size: medium;\"><strong>\u8acb\u7528\u641c\u5c0b\u627e\u5230\u4ee5\u4e0b\u5b57\u4e32\uff1a<\/strong><\/span><\/p>\n<p>memory_limit =<\/p>\n<p><span style=\"color: #008000; font-size: medium;\"><strong>\u4f60\u6703\u627e\u5230\u4ee5\u4e0b\u5b57\u4e32\uff1a<\/strong><\/span><br \/>\n<strong style=\"background-color: #ff99cc;\">memory_limit = 16M\u00a0\u00a0\u00a0\u00a0\u00a0 ; Maximum amount of memory a script may consume (16MB)<\/strong><\/p>\n<p><strong style=\"background-color: #ffff00;\">\/\/\u627e\u5230\u9019\u884c\u539f16M\u4fee\u6539\u70ba32M<\/strong><\/p>\n<p>memory_limit = 32M<\/p>\n<p><span style=\"color: #ff00ff; font-size: medium;\"><strong>2.\u91cd\u65b0\u555f\u52d5apache2<\/strong><\/span><\/p>\n<p><span style=\"font-size: medium;\"><strong>\u8a9e\u6cd5\uff1a<\/strong><\/span><br \/>\n<span style=\"font-size: medium;\"><strong>service apache2 restart<\/strong><\/span><\/p>\n<p>=======================================================<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3010PHP\u7db2\u9801\u958b\u555f\u932f\u8aa4\u7684\u89e3\u6c7a\u65b9\u6cd5\u3011Fatal error: Allowed memory size of 167 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":495,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[21],"class_list":["post-53","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","tag-linux"],"_links":{"self":[{"href":"https:\/\/por.tw\/linux\/wp-json\/wp\/v2\/posts\/53"}],"collection":[{"href":"https:\/\/por.tw\/linux\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/por.tw\/linux\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/por.tw\/linux\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/por.tw\/linux\/wp-json\/wp\/v2\/comments?post=53"}],"version-history":[{"count":0,"href":"https:\/\/por.tw\/linux\/wp-json\/wp\/v2\/posts\/53\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/por.tw\/linux\/wp-json\/wp\/v2\/media\/495"}],"wp:attachment":[{"href":"https:\/\/por.tw\/linux\/wp-json\/wp\/v2\/media?parent=53"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/por.tw\/linux\/wp-json\/wp\/v2\/categories?post=53"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/por.tw\/linux\/wp-json\/wp\/v2\/tags?post=53"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}