{"id":2869,"date":"2019-10-16T18:21:00","date_gmt":"2019-10-16T18:21:00","guid":{"rendered":"https:\/\/azoora.com\/blog\/?p=2869"},"modified":"2019-09-14T18:28:18","modified_gmt":"2019-09-14T18:28:18","slug":"how-to-increase-the-wordpress-file-upload-limit","status":"publish","type":"post","link":"https:\/\/azoora.com\/blog\/wordpress\/how-to-increase-the-wordpress-file-upload-limit\/","title":{"rendered":"How to Increase the WordPress File Upload Limit"},"content":{"rendered":"\n<p>One of the biggest conveniences of a website is having a place to easily share files with visitors. Items such as printable forms,\u00a0eBooks, videos, music and images come to mind.<\/p>\n\n\n\n<p>For those of us who use WordPress as our content management system (CMS), adding these types of files is relatively easy via the&nbsp;<a href=\"https:\/\/wordpress.org\/support\/article\/media-library-screen\/\" target=\"_blank\" rel=\"noreferrer noopener\">Media Library<\/a>. There\u2019s even a built-in way to embed multimedia files, galleries and playlists.<\/p>\n\n\n\n<p>But, depending on your particular setup, you may run into rather restrictive file upload size limits. This makes it difficult to post, say, a full screen HD video or a .ZIP archive of high-resolution PDF files.<\/p>\n\n\n\n<p>Thanks to WP, the upload limit can be increased in most situations, and it\u2019s fairly easy to accomplish. However, the method for doing so greatly depends on your web hosting environment. Let\u2019s take a look at what settings need changed, along with a few different approaches for making them.<\/p>\n\n\n\n<h2>What You\u2019ll Need to Change<\/h2>\n\n\n\n<p>To increase the WordPress file upload limit, you\u2019ll have to change some settings within your hosting account\u2019s PHP configuration. Of course, web hosting companies vary greatly when it comes to server configurations and their own policies for making changes.<\/p>\n\n\n\n<p>Therefore, the approach you take depends largely on which method your host supports. Check out their documentation or ask a support representative to find out what is recommended.<\/p>\n\n\n\n<p>But regardless, we\u2019ll want to change (or at least review) the following settings:<\/p>\n\n\n\n<ul><li><code><a href=\"https:\/\/www.php.net\/manual\/en\/ini.core.php#ini.upload-max-filesize\" target=\"_blank\" rel=\"noreferrer noopener\">upload_max_filesize<\/a><\/code><\/li><li><code><a href=\"https:\/\/www.php.net\/manual\/en\/ini.core.php#ini.post-max-size\" target=\"_blank\" rel=\"noreferrer noopener\">post_max_size<\/a><\/code><\/li><li><code><a href=\"http:\/\/docs.php.net\/manual\/en\/ini.core.php#ini.memory-limit\" target=\"_blank\" rel=\"noreferrer noopener\">memory_limit<\/a><\/code><\/li><li><code><a href=\"https:\/\/www.php.net\/manual\/en\/info.configuration.php#ini.max-execution-time\" target=\"_blank\" rel=\"noreferrer noopener\">max_execution_time<\/a><\/code><\/li><\/ul>\n\n\n\n<p>We\u2019ll get to what they do in a bit. For now, it\u2019s important to know that each of these items (particularly the first three) have a role to play when it comes to uploading files. The last one has a say in processing them (like an import file full of posts, for example), which can also be relevant.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-attachment-id=\"2870\" data-permalink=\"https:\/\/azoora.com\/blog\/wordpress\/how-to-increase-the-wordpress-file-upload-limit\/attachment\/wordpress-file-upload-limit-01\/#main\" data-orig-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/09\/wordpress-file-upload-limit-01.jpg\" data-orig-size=\"850,400\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"wordpress-file-upload-limit-01\" data-image-description=\"\" data-medium-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/09\/wordpress-file-upload-limit-01-300x141.jpg\" data-large-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/09\/wordpress-file-upload-limit-01.jpg\" loading=\"lazy\" width=\"850\" height=\"400\" src=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/09\/wordpress-file-upload-limit-01.jpg\" alt=\"\" class=\"wp-image-2870\" srcset=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/09\/wordpress-file-upload-limit-01.jpg 850w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/09\/wordpress-file-upload-limit-01-300x141.jpg 300w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/09\/wordpress-file-upload-limit-01-768x361.jpg 768w\" sizes=\"(max-width: 850px) 100vw, 850px\" \/><\/figure>\n\n\n\n<h2>Methods for Changing Upload Limits<\/h2>\n\n\n\n<p>Now that we know which settings we\u2019ll want to change, it\u2019s time to do some research. Talk to your web hosting provider regarding which method(s) they support for tweaking PHP settings. It will likely be one of the options below.<\/p>\n\n\n\n<p>Just note that editing these settings is serious business. Therefore, be sure to make backup copies of any files&nbsp;<em>before<\/em>&nbsp;making changes. One false move could potentially cause your site to go down.<\/p>\n\n\n\n<p>With that, here are some of the most common methods for increasing your WordPress file upload limit:<\/p>\n\n\n\n<h3>In Your Hosting Control Panel<\/h3>\n\n\n\n<p>One of the easiest possible ways to adjust these settings is by changing some numbers around in your web hosting control panel. Hosts that use cPanel or a similar GUI may allow you to change PHP settings directly in your browser.<\/p>\n\n\n\n<h3>Directly Editing the&nbsp;<code>php.ini<\/code>&nbsp;File<\/h3>\n\n\n\n<p>Some hosts (or if you\u2019re running a\u00a0local\u00a0hosting environment) enable direct access to your account\u2019s\u00a0<code>php.ini<\/code>\u00a0file. This can be accomplished by downloading the file via FTP, making changes, then uploading it back to its rightful spot on your server.<\/p>\n\n\n\n<p>Alternatively, you may be able to access it via a command line. This is expert territory, though, so be careful!<\/p>\n\n\n\n<h3>Creating and Uploading a&nbsp;<code>.user.ini<\/code>&nbsp;File<\/h3>\n\n\n\n<p>Many hosts would rather you didn\u2019t have direct access to the full&nbsp;<code>php.ini<\/code>&nbsp;file \u2013 and for good reason. As an alternative, they\u2019ll allow you to create a file called \u201c<a href=\"https:\/\/www.php.net\/manual\/en\/configuration.file.per-user.php\" target=\"_blank\" rel=\"noreferrer noopener\"><code>.user.ini<\/code><\/a>\u201d, which lets you manually add and change just the settings you need.<\/p>\n\n\n\n<p>From there, upload it to your server (usually the root directory of your website) and your new settings will override the defaults. This method offers an extra bit of safety, as even if you make a mistake, you can quickly fix or remove the file altogether.<\/p>\n\n\n\n<h3>Modify Your&nbsp;<code>.htaccess<\/code>&nbsp;File<\/h3>\n\n\n\n<p>On some hosts, you can tweak PHP settings via your site\u2019s&nbsp;<a href=\"http:\/\/www.htaccess-guide.com\/\" target=\"_blank\" rel=\"noreferrer noopener\"><code>.htaccess<\/code><\/a>&nbsp;file. This is a hidden file usually found in your site\u2019s root directory. You may have to adjust your FTP software settings in order to see it.<\/p>\n\n\n\n<p>However, use caution when editing this file and keep backups.\u00a0<code>.htaccess<\/code>\u00a0can be used for a number of different server settings, and WordPress depends on it for its Permalink structure.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-attachment-id=\"2871\" data-permalink=\"https:\/\/azoora.com\/blog\/wordpress\/how-to-increase-the-wordpress-file-upload-limit\/attachment\/wordpress-file-upload-limit-02\/#main\" data-orig-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/09\/wordpress-file-upload-limit-02.jpg\" data-orig-size=\"850,400\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"wordpress-file-upload-limit-02\" data-image-description=\"\" data-medium-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/09\/wordpress-file-upload-limit-02-300x141.jpg\" data-large-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/09\/wordpress-file-upload-limit-02.jpg\" loading=\"lazy\" width=\"850\" height=\"400\" src=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/09\/wordpress-file-upload-limit-02.jpg\" alt=\"\" class=\"wp-image-2871\" srcset=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/09\/wordpress-file-upload-limit-02.jpg 850w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/09\/wordpress-file-upload-limit-02-300x141.jpg 300w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/09\/wordpress-file-upload-limit-02-768x361.jpg 768w\" sizes=\"(max-width: 850px) 100vw, 850px\" \/><\/figure>\n\n\n\n<h2>Setting Values<\/h2>\n\n\n\n<p>Once you know how and where to change the PHP settings for your website, it\u2019s now a matter of implementing them. But what are the right values?<\/p>\n\n\n\n<p>This really depends on your specific needs. In most cases, you\u2019ll have some flexibility when increasing your file upload limit. However, the higher the limit, the more potential server resources you\u2019ll use. So, keep that in mind when making changes.<\/p>\n\n\n\n<p>For our purposes, setting the limit to a healthy 24MB should fit most needs \u2013 but you can set yours to whatever you like. Here\u2019s how it\u2019s done.<\/p>\n\n\n\n<p>If you\u2019re editing existing settings in your&nbsp;<strong><code>php.ini<\/code>&nbsp;<\/strong>or creating a&nbsp;<strong><code>.user.ini<\/code><\/strong>&nbsp;file from scratch, your settings will look something like this:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">upload_max_filesize = 24M\npost_max_size = 26M\nmemory_limit = 28M\nmax_execution_time = 300<\/pre>\n\n\n\n<p>If you\u2019re editing an&nbsp;<strong><code>.htaccess<\/code><\/strong>&nbsp;file, your settings will look like the following:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">php_value upload_max_filesize 24M\nphp_value post_max_size 26M\nphp_value memory_limit 28M\nphp_value max_execution_time 300<\/pre>\n\n\n\n<p>Now, let\u2019s provide a little context as to what these settings do and how we arrived at these specific values.<\/p>\n\n\n\n<p><strong><code>upload_max_filesize = 24M<\/code><\/strong><br>This setting will allow for uploading a file that is up to 24MB in size (note that the setting itself uses \u201cM\u201d, rather than \u201cMB\u201d). It can be changed to any number you like, within reason.<\/p>\n\n\n\n<p><strong><code>post_max_size = 26M<\/code><\/strong><br>In general,&nbsp;<code>post_max_size<\/code>&nbsp;should be set to a higher number than&nbsp;<code>upload_max_filesize<\/code>&nbsp;to ensure some breathing room. As shown here, the setting doesn\u2019t have to be significantly higher \u2013 just a little bit extra will do the trick.<\/p>\n\n\n\n<p><strong><code>memory_limit = 28M<\/code><\/strong><br>Subsequently,&nbsp;<code>memory_limit<\/code>&nbsp;should be set even higher still. Following this formula will help to keep things running smoothly.<\/p>\n\n\n\n<p><strong><code>max_execution_time = 300<\/code><\/strong><br>This one is completely optional. It sets the number of seconds (300, in our case) that a PHP script is allowed to run before terminating.<\/p>\n\n\n\n<p>However, it does come in handy when a file upload is being processed by a PHP application, such as WordPress. For example, if you\u2019re uploading a really large file to the Media Library, WordPress (and potentially a plugin) will then need to process the file. That can take a significant amount of time.<\/p>\n\n\n\n<p>Increasing\u00a0<code>max_execution_time<\/code>\u00a0will help to ensure that the process doesn\u2019t time out before it\u2019s had a chance to finish. Again, you\u2019ll want to check with your host to see what is recommended here.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-attachment-id=\"2872\" data-permalink=\"https:\/\/azoora.com\/blog\/wordpress\/how-to-increase-the-wordpress-file-upload-limit\/attachment\/wordpress-file-upload-limit-03\/#main\" data-orig-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/09\/wordpress-file-upload-limit-03.jpg\" data-orig-size=\"850,400\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"wordpress-file-upload-limit-03\" data-image-description=\"\" data-medium-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/09\/wordpress-file-upload-limit-03-300x141.jpg\" data-large-file=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/09\/wordpress-file-upload-limit-03.jpg\" loading=\"lazy\" width=\"850\" height=\"400\" src=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/09\/wordpress-file-upload-limit-03.jpg\" alt=\"\" class=\"wp-image-2872\" srcset=\"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/09\/wordpress-file-upload-limit-03.jpg 850w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/09\/wordpress-file-upload-limit-03-300x141.jpg 300w, https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/09\/wordpress-file-upload-limit-03-768x361.jpg 768w\" sizes=\"(max-width: 850px) 100vw, 850px\" \/><\/figure>\n\n\n\n<h2>One Size Doesn\u2019t Have to Fit All<\/h2>\n\n\n\n<p>The beauty of WordPress is that is offers great flexibility. Not only can themes and plugins help you\u00a0build a website\u00a0to match your exact needs, but there are a number of \u201cunder-the-hood\u201d customizations you can make as well. Many of them tie in directly with PHP.<\/p>\n\n\n\n<p>For those of us that need to upload large files, a quick change to the PHP settings is all it takes. It\u2019s just one more way to make a WordPress website your own.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>One of the biggest conveniences of a website is having a place to easily share files with visitors. Items such as printable forms,\u00a0eBooks, videos, music and images come to mind. For those of us who use WordPress as our content management system (CMS), adding these types of files is relatively easy via the&nbsp;Media Library. There\u2019s [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":2873,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false},"categories":[62,59],"tags":[110,88],"jetpack_featured_media_url":"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/09\/max-upload-size-error-in-wordpress.png","jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/p7FQPL-Kh","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/posts\/2869"}],"collection":[{"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/comments?post=2869"}],"version-history":[{"count":1,"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/posts\/2869\/revisions"}],"predecessor-version":[{"id":2874,"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/posts\/2869\/revisions\/2874"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/media\/2873"}],"wp:attachment":[{"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/media?parent=2869"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/categories?post=2869"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/tags?post=2869"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}