{"id":4895,"date":"2022-01-03T19:11:56","date_gmt":"2022-01-03T06:11:56","guid":{"rendered":"https:\/\/www.zoyinc.com\/?p=4895"},"modified":"2024-01-04T16:58:10","modified_gmt":"2024-01-04T03:58:10","slug":"this-file-exceeds-the-maximum-upload-size-for-this-site","status":"publish","type":"post","link":"http:\/\/www.zoyinc.com\/?p=4895","title":{"rendered":"This file exceeds the maximum upload size for this site"},"content":{"rendered":"\n<p>This is related to the WordPress error you may get when trying to upload a file greater than 2MB:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"845\" height=\"237\" src=\"https:\/\/www.zoyinc.com\/wp-content\/uploads\/2022\/01\/image.png\" alt=\"\" class=\"wp-image-4896\" style=\"width:750px;height:210px\" srcset=\"http:\/\/www.zoyinc.com\/wp-content\/uploads\/2022\/01\/image.png 845w, http:\/\/www.zoyinc.com\/wp-content\/uploads\/2022\/01\/image-300x84.png 300w, http:\/\/www.zoyinc.com\/wp-content\/uploads\/2022\/01\/image-150x42.png 150w, http:\/\/www.zoyinc.com\/wp-content\/uploads\/2022\/01\/image-768x215.png 768w, http:\/\/www.zoyinc.com\/wp-content\/uploads\/2022\/01\/image-500x140.png 500w\" sizes=\"auto, (max-width: 845px) 100vw, 845px\" \/><\/figure>\n\n\n\n<p>While you can install plugins to get around this I found this did not work for me and I then got the error:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"616\" height=\"203\" src=\"https:\/\/www.zoyinc.com\/wp-content\/uploads\/2022\/01\/image-1.png\" alt=\"\" class=\"wp-image-4897\" srcset=\"http:\/\/www.zoyinc.com\/wp-content\/uploads\/2022\/01\/image-1.png 616w, http:\/\/www.zoyinc.com\/wp-content\/uploads\/2022\/01\/image-1-300x99.png 300w, http:\/\/www.zoyinc.com\/wp-content\/uploads\/2022\/01\/image-1-150x49.png 150w, http:\/\/www.zoyinc.com\/wp-content\/uploads\/2022\/01\/image-1-500x165.png 500w\" sizes=\"auto, (max-width: 616px) 100vw, 616px\" \/><\/figure>\n\n\n\n<p>My install of WordPress or more specifically PHP follows the instructions in <a  href=\"https:\/\/www.zoyinc.com\/?p=3780\" data-type=\"post\" data-id=\"3780\">CentOS 7 + PHP 7.2 + Python 3.6 + Apache 2.4<\/a> so in this case I needed to update the php.ini.<\/p>\n\n\n\n<p>My php.ini file was at <\/p>\n\n\n\n<p>\/etc\/opt\/rh\/rh-php73\/php.ini<\/p>\n\n\n\n<p>Change the &#8220;upload_max_filesize&#8221; to say 10MB:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:0.9rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#000000;--cbp-line-number-width:calc(1 * 0.6 * 0.9rem);line-height:1.4rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"; Maximum allowed size for uploaded files.\n; http:\/\/php.net\/upload-max-filesize\nupload_max_filesize = 10M\" style=\"color:#000000;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki light-plus\" style=\"background-color: #FFFFFF\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #000000\">; Maximum <\/span><span style=\"color: #A31515\">allowed<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #A31515\">size<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #A31515\">for<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #A31515\">uploaded<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #A31515\">files.<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">; http:\/\/php.net\/upload-max-filesize<\/span><\/span>\n<span class=\"line\"><span style=\"color: #000000\">upload_max_filesize <\/span><span style=\"color: #A31515\">=<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #A31515\">10M<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Then, since I am using fpm, you need to restart that:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:0.9rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#000000;--cbp-line-number-width:calc(1 * 0.6 * 0.9rem);line-height:1.4rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"systemctl restart rh-php73-php-fpm.service\" style=\"color:#000000;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki light-plus\" style=\"background-color: #FFFFFF\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #000000\">systemctl <\/span><span style=\"color: #A31515\">restart<\/span><span style=\"color: #000000\"> <\/span><span style=\"color: #A31515\">rh-php73-php-fpm.service<\/span><\/span><\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>This is related to the WordPress error you may get when trying to upload a file greater than 2MB: While you can install plugins to get around this I found this did not work for me and I then got the error: My install of WordPress or more specifically PHP follows the instructions in CentOS [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":4353,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,559,10],"tags":[743,46,744,742,208,251,297],"class_list":["post-4895","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","category-php","category-wordpress","tag-file-exceeds-the-maximum","tag-image","tag-jpg","tag-maximum-size","tag-media","tag-php","tag-wordpress"],"_links":{"self":[{"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=\/wp\/v2\/posts\/4895","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4895"}],"version-history":[{"count":3,"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=\/wp\/v2\/posts\/4895\/revisions"}],"predecessor-version":[{"id":5805,"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=\/wp\/v2\/posts\/4895\/revisions\/5805"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=\/wp\/v2\/media\/4353"}],"wp:attachment":[{"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4895"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4895"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.zoyinc.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4895"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}