{"id":56131,"date":"2024-10-10T09:01:20","date_gmt":"2024-10-10T01:01:20","guid":{"rendered":"https:\/\/server.hk\/cnblog\/56131\/"},"modified":"2024-10-10T09:01:20","modified_gmt":"2024-10-10T01:01:20","slug":"wordpress-%e6%95%99%e7%a8%8b%ef%bc%9a%e5%a6%82%e4%bd%95%e8%a7%a3%e6%b1%ba-wordpress-%e4%b8%8a%e5%82%b3%e7%9a%84%e6%96%87%e4%bb%b6%e5%a4%a7%e5%b0%8f%e8%b6%85%e9%81%8e-php-ini-%e9%99%90%e5%88%b6","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/56131\/","title":{"rendered":"WordPress \u6559\u7a0b\uff1a\u5982\u4f55\u89e3\u6c7a WordPress \u4e0a\u50b3\u7684\u6587\u4ef6\u5927\u5c0f\u8d85\u904e php.ini \u9650\u5236"},"content":{"rendered":"<h1 id=\"wordpress-%e6%95%99%e7%a8%8b%ef%bc%9a%e5%a6%82%e4%bd%95%e8%a7%a3%e6%b1%ba-wordpress-%e4%b8%8a%e5%82%b3%e7%9a%84%e6%96%87%e4%bb%b6%e5%a4%a7%e5%b0%8f%e8%b6%85%e9%81%8e-php-ini-%e9%99%90%e5%88%b6-fwoPtAEyGh\">WordPress \u6559\u7a0b\uff1a\u5982\u4f55\u89e3\u6c7a WordPress \u4e0a\u50b3\u7684\u6587\u4ef6\u5927\u5c0f\u8d85\u904e php.ini \u9650\u5236<\/h1>\n<p>\u5728\u4f7f\u7528 WordPress \u5efa\u7acb\u7db2\u7ad9\u7684\u904e\u7a0b\u4e2d\uff0c\u60a8\u53ef\u80fd\u6703\u9047\u5230\u4e0a\u50b3\u6587\u4ef6\u5927\u5c0f\u8d85\u904e php.ini \u9650\u5236\u7684\u554f\u984c\u3002\u9019\u901a\u5e38\u6703\u5c0e\u81f4\u60a8\u7121\u6cd5\u4e0a\u50b3\u5927\u578b\u5716\u7247\u3001\u4e3b\u984c\u6216\u63d2\u4ef6\uff0c\u5f71\u97ff\u7db2\u7ad9\u7684\u529f\u80fd\u548c\u4f7f\u7528\u9ad4\u9a57\u3002\u672c\u6587\u5c07\u4ecb\u7d39\u5982\u4f55\u89e3\u6c7a\u9019\u4e00\u554f\u984c\uff0c\u5e6b\u52a9\u60a8\u9806\u5229\u4e0a\u50b3\u6240\u9700\u7684\u6587\u4ef6\u3002<\/p>\n<h2 id=\"%e4%ba%86%e8%a7%a3-php-ini-%e9%99%90%e5%88%b6-fwoPtAEyGh\">\u4e86\u89e3 php.ini \u9650\u5236<\/h2>\n<p>php.ini \u662f PHP \u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u8ca0\u8cac\u8a2d\u5b9a PHP \u7684\u5404\u7a2e\u53c3\u6578\uff0c\u5305\u62ec\u4e0a\u50b3\u6587\u4ef6\u7684\u5927\u5c0f\u9650\u5236\u3002\u4ee5\u4e0b\u662f\u8207\u6587\u4ef6\u4e0a\u50b3\u76f8\u95dc\u7684\u5e7e\u500b\u91cd\u8981\u53c3\u6578\uff1a<\/p>\n<ul>\n<li><code>upload_max_filesize<\/code>\uff1a\u5b9a\u7fa9\u55ae\u500b\u4e0a\u50b3\u6587\u4ef6\u7684\u6700\u5927\u5927\u5c0f\u3002<\/li>\n<li><code>post_max_size<\/code>\uff1a\u5b9a\u7fa9\u6574\u500b POST \u8acb\u6c42\u7684\u6700\u5927\u5927\u5c0f\uff0c\u5305\u62ec\u6240\u6709\u4e0a\u50b3\u7684\u6587\u4ef6\u3002<\/li>\n<li><code>max_execution_time<\/code>\uff1a\u5b9a\u7fa9 PHP \u8173\u672c\u7684\u6700\u5927\u57f7\u884c\u6642\u9593\u3002<\/li>\n<\/ul>\n<p>\u5982\u679c\u60a8\u5617\u8a66\u4e0a\u50b3\u7684\u6587\u4ef6\u5927\u5c0f\u8d85\u904e\u9019\u4e9b\u9650\u5236\uff0cWordPress \u5c07\u986f\u793a\u932f\u8aa4\u4fe1\u606f\uff0c\u963b\u6b62\u4e0a\u50b3\u3002<\/p>\n<h2 id=\"%e6%aa%a2%e6%9f%a5%e7%95%b6%e5%89%8d%e7%9a%84-php-ini-%e8%a8%ad%e5%ae%9a-fwoPtAEyGh\">\u6aa2\u67e5\u7576\u524d\u7684 php.ini \u8a2d\u5b9a<\/h2>\n<p>\u9996\u5148\uff0c\u60a8\u9700\u8981\u6aa2\u67e5\u7576\u524d\u7684 php.ini \u8a2d\u5b9a\u3002\u60a8\u53ef\u4ee5\u901a\u904e\u5275\u5efa\u4e00\u500b PHP \u6587\u4ef6\u4f86\u67e5\u770b\u9019\u4e9b\u8a2d\u7f6e\u3002\u8acb\u6309\u7167\u4ee5\u4e0b\u6b65\u9a5f\u64cd\u4f5c\uff1a<\/p>\n<pre>\n1. \u5728\u60a8\u7684 WordPress \u6839\u76ee\u9304\u4e2d\u5275\u5efa\u4e00\u500b\u540d\u70ba <code>phpinfo.php<\/code> \u7684\u6587\u4ef6\u3002\n2. \u5728\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u78bc\uff1a\n   <code>\n   \n   <\/code>\n3. \u4fdd\u5b58\u6587\u4ef6\u4e26\u901a\u904e\u700f\u89bd\u5668\u8a2a\u554f <code>http:\/\/yourdomain.com\/phpinfo.php<\/code>\u3002\n   <\/pre>\n<p>\u5728\u986f\u793a\u7684\u9801\u9762\u4e2d\uff0c\u67e5\u627e <code>upload_max_filesize<\/code> \u548c <code>post_max_size<\/code> \u7684\u503c\uff0c\u4ee5\u78ba\u5b9a\u7576\u524d\u7684\u9650\u5236\u3002<\/p>\n<h2 id=\"%e4%bf%ae%e6%94%b9-php-ini-%e8%a8%ad%e5%ae%9a-fwoPtAEyGh\">\u4fee\u6539 php.ini \u8a2d\u5b9a<\/h2>\n<p>\u5982\u679c\u60a8\u9700\u8981\u589e\u52a0\u6587\u4ef6\u4e0a\u50b3\u5927\u5c0f\u9650\u5236\uff0c\u53ef\u4ee5\u901a\u904e\u4ee5\u4e0b\u5e7e\u7a2e\u65b9\u6cd5\u4f86\u4fee\u6539 php.ini \u8a2d\u5b9a\uff1a<\/p>\n<h3 id=\"1-%e7%9b%b4%e6%8e%a5%e7%b7%a8%e8%bc%af-php-ini-%e6%96%87%e4%bb%b6-fwoPtAEyGh\">1. \u76f4\u63a5\u7de8\u8f2f php.ini \u6587\u4ef6<\/h3>\n<p>\u5982\u679c\u60a8\u6709\u6b0a\u9650\u8a2a\u554f\u4f3a\u670d\u5668\u7684 php.ini \u6587\u4ef6\uff0c\u53ef\u4ee5\u76f4\u63a5\u7de8\u8f2f\u5b83\u3002\u627e\u5230\u4ee5\u4e0b\u884c\u4e26\u4fee\u6539\u70ba\u6240\u9700\u7684\u503c\uff1a<\/p>\n<pre>\nupload_max_filesize = 64M\npost_max_size = 64M\nmax_execution_time = 300\n<\/pre>\n<p>\u4fee\u6539\u5f8c\uff0c\u8acb\u91cd\u555f\u60a8\u7684\u7db2\u9801\u4f3a\u670d\u5668\u4ee5\u4f7f\u66f4\u6539\u751f\u6548\u3002<\/p>\n<h3 id=\"2-%e4%bd%bf%e7%94%a8-htaccess-%e6%96%87%e4%bb%b6-fwoPtAEyGh\">2. \u4f7f\u7528 .htaccess \u6587\u4ef6<\/h3>\n<p>\u5982\u679c\u60a8\u7121\u6cd5\u8a2a\u554f php.ini \u6587\u4ef6\uff0c\u53ef\u4ee5\u5617\u8a66\u5728 WordPress \u6839\u76ee\u9304\u4e2d\u6dfb\u52a0\u6216\u7de8\u8f2f .htaccess \u6587\u4ef6\uff0c\u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u78bc\uff1a<\/p>\n<pre>\n\n    php_value upload_max_filesize 64M\n    php_value post_max_size 64M\n    php_value max_execution_time 300\n\n<\/pre>\n<h3 id=\"3-%e4%bd%bf%e7%94%a8-wp-config-php-%e6%96%87%e4%bb%b6-fwoPtAEyGh\">3. \u4f7f\u7528 wp-config.php \u6587\u4ef6<\/h3>\n<p>\u53e6\u4e00\u7a2e\u65b9\u6cd5\u662f\u5728 wp-config.php \u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u4ee3\u78bc\uff1a<\/p>\n<pre>\n@ini_set('upload_max_filesize', '64M');\n@ini_set('post_max_size', '64M');\n@ini_set('max_execution_time', '300');\n<\/pre>\n<h2 id=\"%e4%bd%bf%e7%94%a8%e6%8f%92%e4%bb%b6%e4%be%86%e8%a7%a3%e6%b1%ba%e5%95%8f%e9%a1%8c-fwoPtAEyGh\">\u4f7f\u7528\u63d2\u4ef6\u4f86\u89e3\u6c7a\u554f\u984c<\/h2>\n<p>\u5982\u679c\u60a8\u4e0d\u60f3\u624b\u52d5\u7de8\u8f2f\u6587\u4ef6\uff0c\u9084\u53ef\u4ee5\u4f7f\u7528 WordPress \u63d2\u4ef6\u4f86\u589e\u52a0\u4e0a\u50b3\u6587\u4ef6\u5927\u5c0f\u9650\u5236\u3002\u4f8b\u5982\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528 <strong>WP Increase Upload Filesize<\/strong> \u63d2\u4ef6\uff0c\u9019\u662f\u4e00\u500b\u7c21\u55ae\u6613\u7528\u7684\u5de5\u5177\uff0c\u53ef\u4ee5\u5e6b\u52a9\u60a8\u8f15\u9b06\u8abf\u6574\u4e0a\u50b3\u9650\u5236\u3002<\/p>\n<h2 id=\"%e7%b8%bd%e7%b5%90-fwoPtAEyGh\">\u7e3d\u7d50<\/h2>\n<p>\u89e3\u6c7a WordPress \u4e0a\u50b3\u6587\u4ef6\u5927\u5c0f\u8d85\u904e php.ini \u9650\u5236\u7684\u554f\u984c\u4e26\u4e0d\u56f0\u96e3\u3002\u901a\u904e\u6aa2\u67e5\u548c\u4fee\u6539 php.ini \u8a2d\u5b9a\u3001\u4f7f\u7528 .htaccess \u6216 wp-config.php \u6587\u4ef6\uff0c\u6216\u662f\u5b89\u88dd\u76f8\u95dc\u63d2\u4ef6\uff0c\u60a8\u90fd\u53ef\u4ee5\u8f15\u9b06\u5730\u589e\u52a0\u4e0a\u50b3\u6587\u4ef6\u7684\u5927\u5c0f\u9650\u5236\u3002\u9019\u6a23\uff0c\u60a8\u5c31\u80fd\u5920\u9806\u5229\u4e0a\u50b3\u6240\u9700\u7684\u6587\u4ef6\uff0c\u63d0\u5347\u7db2\u7ad9\u7684\u529f\u80fd\u6027\u548c\u4f7f\u7528\u9ad4\u9a57\u3002<\/p>\n<p>\u5982\u679c\u60a8\u6b63\u5728\u5c0b\u627e\u7a69\u5b9a\u7684 <a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a> \u670d\u52d9\uff0cServer.HK \u63d0\u4f9b\u591a\u7a2e\u65b9\u6848\u4ee5\u6eff\u8db3\u60a8\u7684\u9700\u6c42\uff0c\u7121\u8ad6\u662f\u500b\u4eba\u7db2\u7ad9\u9084\u662f\u5546\u696d\u61c9\u7528\uff0c\u5747\u53ef\u8f15\u9b06\u61c9\u5c0d\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b78\u7fd2\u5982\u4f55\u89e3\u6c7a WordPress \u4e0a\u50b3\u6587\u4ef6\u5927\u5c0f\u8d85\u904e php.ini \u9650\u5236\u7684\u554f\u984c\uff0c\u8f15\u9b06\u8abf\u6574\u8a2d\u7f6e\uff0c\u63d0\u5347\u7db2\u7ad9\u529f\u80fd\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4925],"tags":[],"class_list":["post-56131","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/56131","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=56131"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/56131\/revisions"}],"predecessor-version":[{"id":56132,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/56131\/revisions\/56132"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=56131"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=56131"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=56131"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}