{"id":3938,"date":"2019-12-13T09:00:06","date_gmt":"2019-12-13T01:00:06","guid":{"rendered":"https:\/\/blog.naibabiji.com\/?p=3938"},"modified":"2019-12-21T17:26:21","modified_gmt":"2019-12-21T09:26:21","slug":"wordpress-upload-max-filesize","status":"publish","type":"post","link":"https:\/\/blog.naibabiji.com\/skill\/wordpress-upload-max-filesize.html","title":{"rendered":"5\u4e2a\u7ed9WordPress\u589e\u52a0\u4e0a\u4f20\u9644\u4ef6\u5927\u5c0f\u7684\u6b63\u786e\u65b9\u6cd5"},"content":{"rendered":"<p style=\"text-align: left;\">\u5927\u5bb6\u597d\uff0c\u6211\u662f\u96f7\u950b\u54e5\u3002\u6700\u8fd1\u96f7\u950b\u54e5\u5e2e\u4eba\u5236\u4f5c\u4e86\u4e00\u4e2a\u7f51\u7ad9\uff0c\u9700\u8981\u4e0a\u4f20\u89c6\u9891\u5927\u6587\u4ef6\uff0c\u800c WordPress \u7684\u5a92\u4f53\u6587\u4ef6\u4e0a\u4f20\u9650\u5236\u901a\u5e38\u572850M\u5185\uff0c\u8ddf\u4f60\u5b89\u88c5\u7684\u73af\u5883\u914d\u7f6e\u6709\u5173\u7cfb\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3942\" src=\"https:\/\/edgeone.naibabiji.com\/wp-content\/uploads\/2019\/12\/20191212222710.png\" alt=\"\" width=\"562\" height=\"349\" \/><\/p>\n<p style=\"text-align: left;\">\u5728\u7f51\u4e0a\u641c\u7d22\u4e86\u4e00\u5708\u6559\u7a0b\uff0c\u5f88\u591a\u662f\u9519\u8bef\u7684\uff0c\u751a\u81f3\u8fd8\u6709\u8bf4\u5728 functions.php \u4e2d\u6dfb\u52a0 @ini_set( &#8216;upload_max_size&#8217; , &#8217;64M&#8217; ); \uff0c\u5176\u5b9e\u662f\u6ca1\u7528\u7684\uff0c\u6700\u6b63\u786e\u65b9\u6cd5\u5e94\u8be5\u662f\u8981\u4fee\u6539 php.ini \u6587\u4ef6 + nginx \/ Apache\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u4e0b\u9762\u7ed9\u5927\u5bb6\u8bf4\u8bf4\u5982\u4f55\u4fee\u6539\u3002<\/p>\n<p># \u4f7f\u7528SSH\u8f6f\u4ef6\u8fde\u63a5\u4e0aVPS\u670d\u52a1\u5668<\/p>\n<p># \u53c2\u8003\u6559\u7a0b\uff1a<a href=\"https:\/\/blog.naibabiji.com\/tutorial\/xshell-6-lian-jie-vps.html\">#\u5efa\u7ad9#Xshell 6\u57fa\u672c\u6559\u7a0b\uff1a \u8fde\u63a5VPS<\/a><\/p>\n<p>\u5982\u679c\u4f60\u4e0d\u4f1a\u5728ssh\u91cc\u9762\u76f4\u63a5\u4fee\u6539\uff0c\u4f60\u4e5f\u53ef\u4ee5\u4f7f\u7528<a href=\"https:\/\/blog.naibabiji.com\/files\/xshell-xftp.html\">xftp<\/a>\u8fd9\u4e9b\u8f6f\u4ef6\u628a\u6587\u4ef6\u4e0b\u8f7d\u5230\u672c\u5730\u4fee\u6539\u540e\u4e0a\u4f20\u5230\u670d\u52a1\u5668\u8986\u76d6\u3002<\/p>\n<h2>php.ini\u4fee\u6539\u4e0a\u4f20\u9644\u4ef6\u5927\u5c0f<\/h2>\n<p><strong>\u7b2c\u4e00\u6b65\uff1a<\/strong>\u8f93\u5165 php -i | grep &#8216;php.ini&#8217;<\/p>\n<p><strong>\u7b2c\u4e8c\u6b65\uff1a<\/strong>\u590d\u5236\u83b7\u53d6\u5230\u7684 php.ini\u8def\u5f84<\/p>\n<p><strong>\u7b2c\u4e09\u6b65\uff1a<\/strong>\u8f93\u5165 sudo gedit \/usr\/local\/php\/etc\/php.ini \uff08\u6216\u8005\u4f7f\u7528\u4f60\u559c\u6b22\u7684\u7f16\u8f91\u5668\uff0c\u5982vim\uff09<\/p>\n<p><strong>\u7b2c\u56db\u6b65\uff1a<\/strong>\u641c\u7d22 upload_max_filesize \u540e\u9762\u7684\u6570\u503c\u4fee\u6539\u6210 = 5000M\uff08\u8fd9\u91cc\u6211\u662f\u6539\u62105G\uff09<\/p>\n<p><strong>\u7b2c\u4e94\u6b65\uff1a<\/strong>\u641c\u7d22 post_max_size \u540e\u9762\u7684\u6570\u503c\u4fee\u6539\u6210 = 5000M\uff08\u8fd9\u91cc\u6211\u662f\u6539\u62105G\uff09<\/p>\n<p><strong>\u7b2c\u516d\u6b65\uff1a<\/strong>\u4fdd\u5b58<\/p>\n<h2>nginx\u4fee\u6539\u4e0a\u4f20\u9644\u4ef6\u5927\u5c0f<\/h2>\n<p><strong>\u7b2c\u4e00\u6b65\uff1a<\/strong>\u8f93\u5165 sudo gedit \/usr\/local\/nginx\/conf\/vhost\/www.\u4f60\u7684\u57df\u540d.conf\uff08\u6216\u8005\u4f7f\u7528\u4f60\u559c\u6b22\u7684\u7f16\u8f91\u5668\uff0c\u5982vim\uff09<\/p>\n<p>\u6ce8\uff1a\u4f60\u7f51\u7ad9\u7684\u914d\u7f6e\u6587\u4ef6\u53ef\u80fd\u4e0d\u662f\u4e0a\u9762\u8fd9\u4e2a\u4f4d\u7f6e\uff0c\u8bf7\u6839\u636e\u81ea\u5df1\u5b9e\u9645\u60c5\u51b5\u4fee\u6539\u547d\u4ee4\u8def\u5f84\u3002<\/p>\n<p><strong>\u7b2c\u4e8c\u6b65<\/strong>\uff1a\u5728\u6253\u5f00\u7684.conf\u6587\u4ef6\u91cc\u9762\u6dfb\u52a0\u4e0b\u9762\u5185\u5bb9\uff0c\u7136\u540e\u4fdd\u5b58<\/p>\n<pre>location ~ .php$ {\r\nclient_max_body_size 5000M;\r\n}<\/pre>\n<p><strong>\u7b2c\u4e09\u6b65<\/strong>\uff1a\u91cd\u65b0\u8f7d\u5165nginx\u914d\u7f6e\u6216\u8005\u91cd\u542fnginx\u4f7f\u5176\u751f\u6548\u3002<\/p>\n<h2>apache\u4fee\u6539\u4e0a\u4f20\u9644\u4ef6\u5927\u5c0f<\/h2>\n<p>\u6253\u5f00\u7f51\u7ad9\u6839\u76ee\u5f55\u7684 .htaccess \u6587\u4ef6\uff0c\u6dfb\u52a0\u4e0b\u9762\u5185\u5bb9\uff1a<\/p>\n<pre>php_value upload_max_filesize 5000M\r\nphp_value post_max_size 5000M<\/pre>\n<p>\u7136\u540e\u4fdd\u5b58\uff0c\u5c31\u53ef\u4ee5\u628a\u589e\u52a0\u9644\u4ef6\u4e0a\u4f20\u5927\u5c0f\u4e86\u3002<\/p>\n<h2>\u5b9d\u5854\u9762\u677f\u589e\u4fee\u6539WP\u9644\u4ef6\u4e0a\u4f20\u5927\u5c0f<\/h2>\n<p># \u5b9d\u5854\u9762\u677f\u5b89\u88c5\u6559\u7a0b\uff1a<a href=\"https:\/\/blog.naibabiji.com\/tutorial\/install-bt.html\">\u65b0\u624b\u81ea\u5df1\u5efa\u7f51\u7ad9\u53cb\u597d\u7684\u5b9d\u5854\u9762\u677f\u56fe\u6587\u5b89\u88c5\u6559\u7a0b<\/a><\/p>\n<p><strong>\u7b2c\u4e00\u6b65\uff1a<\/strong>\u8f6f\u4ef6\u5546\u5e97 \u2192 \u5df2\u5b89\u88c5 \u2192\u00a0 php \u2192\u00a0 \u8bbe\u7f6e \u2192 \u914d\u7f6e\u4fee\u6539\uff0c\u628a Post_max_size \u548c upload_max_filesize \u4fee\u6539\u6210\u4f60\u9700\u8981\u7684\u4e0a\u4f20\u5bb9\u91cf\u5927\u5c0f\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3939\" src=\"https:\/\/edgeone.naibabiji.com\/wp-content\/uploads\/2019\/12\/20191212222259.png\" alt=\"\" width=\"857\" height=\"628\" \/><\/p>\n<p><strong>\u7b2c\u4e8c\u6b65\uff1a<\/strong>\u4ee5 nginx \u4e3a\u4f8b\uff0c\u6253\u5f00\u8f6f\u4ef6\u5546\u5e97 \u2192 \u5df2\u5b89\u88c5 \u2192\u00a0 nginx \u2192\u00a0 \u8bbe\u7f6e \u2192 \u6027\u80fd\u8c03\u6574\uff0c\u627e\u5230Client_max_body_size \u4fee\u6539\u6210\u4f60\u9700\u8981\u7684\u4e0a\u4f20\u5bb9\u91cf\u5927\u5c0f\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3941\" src=\"https:\/\/edgeone.naibabiji.com\/wp-content\/uploads\/2019\/12\/20191212222524.png\" alt=\"\" width=\"930\" height=\"674\" \/><\/p>\n<p>\u6700\u540e\u9700\u8981\u91cd\u542f PHP \u548c nginx \/ Apache \u624d\u80fd\u751f\u6548\u54e6\u3002<\/p>\n<h2>\u591a\u7ad9\u70b9 WordPress \u8bbe\u7f6e<\/h2>\n<p>\u5982\u679c\u4f60\u662f<a href=\"https:\/\/blog.naibabiji.com\/tutorial\/wordpress-kai-qi-duo-zhan-dian.html\">\u591a\u7ad9\u70b9\u7684 WordPress<\/a> \u901a\u8fc7\u4e0a\u9762\u7684\u8bbe\u7f6e\u540e\uff0c\u8fd8\u9700\u8981\u5728\u8d85\u7ea7\u7528\u6237\u767b\u5f55 \u2192 \u8bbe\u7f6e\u00a0 \u2192 \u7f51\u7edc\u8bbe\u7f6e\uff0c\u627e\u5230\u201c\u4e0a\u4f20\u8bbe\u7f6e\u201d\uff0c\u91cc\u9762\u5355\u72ec\u8bbe\u7f6e\u9644\u4ef6\u5927\u5c0f\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3943\" src=\"https:\/\/edgeone.naibabiji.com\/wp-content\/uploads\/2019\/12\/wordpress-multisite-upload-setting.jpg\" alt=\"\" width=\"480\" height=\"360\" \/><\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u7ed9 WordPress \u589e\u52a0\u4e0a\u4f20\u9644\u4ef6\u5927\u5c0f\u7684\u6b63\u786e\u65b9\u6cd5\u4e86\uff0c\u5982\u679c\u6ca1\u6709\u5fc5\u8981\uff0c\u8fd8\u662f\u4e0d\u8981\u628a\u4e0a\u4f20\u9644\u4ef6\u8bbe\u7f6e\u592a\u5927\uff0c\u4ee5\u514d\u56e0\u4e3a\u4e0a\u4f20\u592a\u5927\u7684\u9644\u4ef6\uff0c\u5f71\u54cd\u6027\u80fd\u3002\u4e34\u65f6\u9700\u8981\u4e0a\u4f20\u7684\u8bdd\u53ef\u4ee5\u901a\u8fc7 FTP \u6765\u4f20\u3002<\/p>\n\n\n<div class=\"kk-star-ratings kksr-auto kksr-align-center kksr-valign-bottom\"\n    data-payload='{&quot;align&quot;:&quot;center&quot;,&quot;id&quot;:&quot;3938&quot;,&quot;slug&quot;:&quot;default&quot;,&quot;valign&quot;:&quot;bottom&quot;,&quot;ignore&quot;:&quot;&quot;,&quot;reference&quot;:&quot;auto&quot;,&quot;class&quot;:&quot;&quot;,&quot;count&quot;:&quot;1&quot;,&quot;legendonly&quot;:&quot;&quot;,&quot;readonly&quot;:&quot;&quot;,&quot;score&quot;:&quot;5&quot;,&quot;starsonly&quot;:&quot;&quot;,&quot;best&quot;:&quot;5&quot;,&quot;gap&quot;:&quot;4&quot;,&quot;greet&quot;:&quot;\u7ed9\u672c\u6587\u6253\u5206 post&quot;,&quot;legend&quot;:&quot;5\\\/5 - (1 vote)&quot;,&quot;size&quot;:&quot;24&quot;,&quot;title&quot;:&quot;5\u4e2a\u7ed9WordPress\u589e\u52a0\u4e0a\u4f20\u9644\u4ef6\u5927\u5c0f\u7684\u6b63\u786e\u65b9\u6cd5&quot;,&quot;width&quot;:&quot;138&quot;,&quot;_legend&quot;:&quot;{score}\\\/{best} - ({count} {votes})&quot;,&quot;font_factor&quot;:&quot;1.25&quot;}'>\n            \n<div class=\"kksr-stars\">\n    \n<div class=\"kksr-stars-inactive\">\n            <div class=\"kksr-star\" data-star=\"1\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"2\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"3\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"4\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" data-star=\"5\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n    <\/div>\n    \n<div class=\"kksr-stars-active\" style=\"width: 138px;\">\n            <div class=\"kksr-star\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n            <div class=\"kksr-star\" style=\"padding-right: 4px\">\n            \n\n<div class=\"kksr-icon\" style=\"width: 24px; height: 24px;\"><\/div>\n        <\/div>\n    <\/div>\n<\/div>\n                \n\n<div class=\"kksr-legend\" style=\"font-size: 19.2px;\">\n            5\/5 - (1 vote)    <\/div>\n    <\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u5927\u5bb6\u597d\uff0c\u6211\u662f\u96f7\u950b\u54e5\u3002\u6700\u8fd1\u96f7\u950b\u54e5\u5e2e\u4eba\u5236\u4f5c\u4e86\u4e00\u4e2a\u7f51\u7ad9\uff0c\u9700\u8981\u4e0a\u4f20\u89c6\u9891\u5927\u6587\u4ef6\uff0c\u800c WordPress \u7684\u5a92\u4f53\u6587\u4ef6\u4e0a\u4f20\u9650 [&hellip;]<\/p>\n","protected":false},"author":63,"featured_media":3945,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"slim_seo":{"title":"5\u4e2a\u7ed9WordPress\u589e\u52a0\u4e0a\u4f20\u9644\u4ef6\u5927\u5c0f\u7684\u6b63\u786e\u65b9\u6cd5 - \u5976\u7238\u5efa\u7ad9\u7b14\u8bb0","description":"\u5927\u5bb6\u597d\uff0c\u6211\u662f\u96f7\u950b\u54e5\u3002\u6700\u8fd1\u96f7\u950b\u54e5\u5e2e\u4eba\u5236\u4f5c\u4e86\u4e00\u4e2a\u7f51\u7ad9\uff0c\u9700\u8981\u4e0a\u4f20\u89c6\u9891\u5927\u6587\u4ef6\uff0c\u800c WordPress \u7684\u5a92\u4f53\u6587\u4ef6\u4e0a\u4f20\u9650\u5236\u901a\u5e38\u572850M\u5185\uff0c\u8ddf\u4f60\u5b89\u88c5\u7684\u73af\u5883\u914d\u7f6e\u6709\u5173\u7cfb\u3002 \u5728\u7f51\u4e0a\u641c\u7d22\u4e86\u4e00\u5708\u6559\u7a0b\uff0c\u5f88\u591a\u662f\u9519\u8bef\u7684\uff0c\u751a\u81f3\u8fd8\u6709\u8bf4\u5728 functions.php \u4e2d\u6dfb\u52a0 @ini_set( 'upload_max_size' , '64M' );"},"footnotes":""},"categories":[142],"tags":[],"class_list":["post-3938","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-skill"],"_links":{"self":[{"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/posts\/3938","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/users\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/comments?post=3938"}],"version-history":[{"count":0,"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/posts\/3938\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/media\/3945"}],"wp:attachment":[{"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/media?parent=3938"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/categories?post=3938"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.naibabiji.com\/wp-json\/wp\/v2\/tags?post=3938"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}