{"id":3333,"date":"2023-05-01T08:52:19","date_gmt":"2023-05-01T08:52:19","guid":{"rendered":"https:\/\/buddydev.com\/docs\/?p=3333"},"modified":"2023-05-01T08:52:19","modified_gmt":"2023-05-01T08:52:19","slug":"how-to-change-the-maximum-upload-file-size-for-php","status":"publish","type":"post","link":"https:\/\/buddydev.com\/docs\/general\/how-to-change-the-maximum-upload-file-size-for-php\/","title":{"rendered":"How to change the maximum upload file size for PHP"},"content":{"rendered":"<p>To change the maximum upload file size for PHP, you need to modify two PHP configuration settings:<strong> `upload_max_filesize`<\/strong> and <strong>`post_max_size`<\/strong>. Here are the steps you can follow:<\/p>\n<p><strong>Step 1:-<\/strong> Locate the PHP configuration file called `php.ini`. If you are not sure where this file is located, you can create a new PHP file with the following code:<\/p>\n<pre class=\"lang:php decode:true \">&lt;?php phpinfo(); ?&gt;<\/pre>\n<p>Then, open the file in a web browser, and look for the &#8220;Loaded Configuration File&#8221; value. This will tell you where the `php.ini` file is located.<\/p>\n<p>Here is a screenshot showing the same.<\/p>\n<p><a href=\"https:\/\/buddydev.com\/docs\/files\/2023\/05\/php-ini-location-in-phpinfo.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-3337\" src=\"https:\/\/buddydev.com\/docs\/files\/2023\/05\/php-ini-location-in-phpinfo-300x96.png\" alt=\"\" width=\"300\" height=\"96\" srcset=\"https:\/\/buddydev.com\/docs\/files\/2023\/05\/php-ini-location-in-phpinfo-300x96.png 300w, https:\/\/buddydev.com\/docs\/files\/2023\/05\/php-ini-location-in-phpinfo-768x246.png 768w, https:\/\/buddydev.com\/docs\/files\/2023\/05\/php-ini-location-in-phpinfo-480x154.png 480w, https:\/\/buddydev.com\/docs\/files\/2023\/05\/php-ini-location-in-phpinfo.png 969w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><strong>Step 2:-<\/strong> Open the `php.ini` file in a text editor.(e.g nano php.ini). You will need administrative privilege to edit it(e.g sudo user)<\/p>\n<p><strong>Step 3:-<\/strong> Search for the <strong>`upload_max_filesize`<\/strong> setting. This sets the maximum size of an individual file that can be uploaded. By default, this is usually set to 2M (2 megabytes).<\/p>\n<p><strong>Step 4:-<\/strong> Change the value to the desired maximum file size. For example, to set the maximum file size to 20 megabytes, you can use the following:<\/p>\n<pre class=\"lang:ini decode:true \">upload_max_filesize = 20M<\/pre>\n<p>Note that you can use different size units, such as `K` for kilobytes or `G` for gigabytes.<\/p>\n<p><strong>Step 5:-<\/strong> Search for the <strong>`post_max_size`<\/strong> setting. This sets the maximum size of the entire HTTP POST request, which includes the uploaded files. By default, this is usually set to 8M.<\/p>\n<p><strong>Step 6:-<\/strong> Change the value to the desired maximum request size. For example, to set the maximum request size to 25 megabytes, you can use the following:<\/p>\n<pre class=\"lang:ini decode:true \"> post_max_size = 25M<\/pre>\n<p><strong>Step 7:-<\/strong>\u00a0 <strong>Save<\/strong> the `php.ini` file and <strong>restart your web server<\/strong>. This will apply the changes.<\/p>\n<p>Congratulations!, your PHP scripts will be able to handle larger file uploads now.<\/p>\n<p><strong>References:-<\/strong><\/p>\n<ul>\n<li>https:\/\/www.php.net\/manual\/en\/ini.core.php#ini.upload-max-filesize<\/li>\n<li>https:\/\/www.php.net\/manual\/en\/ini.core.php#ini.post-max-size<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>To change the maximum upload file size for PHP, you need to modify two PHP configuration settings: `upload_max_filesize` and `post_max_size`. Here are the steps you can follow: Step 1:- Locate the PHP configuration file called `php.ini`. If you are not sure where this file is located, you can create a new PHP file with the &#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["clearfix","post-3333","post","type-post","status-publish","format-standard","hentry","category-general"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to change the maximum upload file size for PHP &#8226; BuddyDev Help Center<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/buddydev.com\/docs\/general\/how-to-change-the-maximum-upload-file-size-for-php\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to change the maximum upload file size for PHP &#8226; BuddyDev Help Center\" \/>\n<meta property=\"og:description\" content=\"To change the maximum upload file size for PHP, you need to modify two PHP configuration settings: `upload_max_filesize` and `post_max_size`. Here are the steps you can follow: Step 1:- Locate the PHP configuration file called `php.ini`. If you are not sure where this file is located, you can create a new PHP file with the ...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/buddydev.com\/docs\/general\/how-to-change-the-maximum-upload-file-size-for-php\/\" \/>\n<meta property=\"og:site_name\" content=\"BuddyDev Help Center\" \/>\n<meta property=\"article:published_time\" content=\"2023-05-01T08:52:19+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/buddydev.com\/docs\/files\/2023\/05\/php-ini-location-in-phpinfo-300x96.png\" \/>\n<meta name=\"author\" content=\"Brajesh Singh\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Brajesh Singh\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/buddydev.com\/docs\/general\/how-to-change-the-maximum-upload-file-size-for-php\/\",\"url\":\"https:\/\/buddydev.com\/docs\/general\/how-to-change-the-maximum-upload-file-size-for-php\/\",\"name\":\"How to change the maximum upload file size for PHP &#8226; BuddyDev Help Center\",\"isPartOf\":{\"@id\":\"https:\/\/buddydev.com\/docs\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/buddydev.com\/docs\/general\/how-to-change-the-maximum-upload-file-size-for-php\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/buddydev.com\/docs\/general\/how-to-change-the-maximum-upload-file-size-for-php\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/buddydev.com\/docs\/files\/2023\/05\/php-ini-location-in-phpinfo-300x96.png\",\"datePublished\":\"2023-05-01T08:52:19+00:00\",\"author\":{\"@id\":\"https:\/\/buddydev.com\/docs\/#\/schema\/person\/4ebf5f3e519f8cbddc6583e182dbe4fb\"},\"breadcrumb\":{\"@id\":\"https:\/\/buddydev.com\/docs\/general\/how-to-change-the-maximum-upload-file-size-for-php\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/buddydev.com\/docs\/general\/how-to-change-the-maximum-upload-file-size-for-php\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/buddydev.com\/docs\/general\/how-to-change-the-maximum-upload-file-size-for-php\/#primaryimage\",\"url\":\"https:\/\/buddydev.com\/docs\/files\/2023\/05\/php-ini-location-in-phpinfo.png\",\"contentUrl\":\"https:\/\/buddydev.com\/docs\/files\/2023\/05\/php-ini-location-in-phpinfo.png\",\"width\":969,\"height\":310},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/buddydev.com\/docs\/general\/how-to-change-the-maximum-upload-file-size-for-php\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/buddydev.com\/docs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to change the maximum upload file size for PHP\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/buddydev.com\/docs\/#website\",\"url\":\"https:\/\/buddydev.com\/docs\/\",\"name\":\"BuddyDev Help Center\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/buddydev.com\/docs\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/buddydev.com\/docs\/#\/schema\/person\/4ebf5f3e519f8cbddc6583e182dbe4fb\",\"name\":\"Brajesh Singh\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/buddydev.com\/docs\/#\/schema\/person\/image\/\",\"url\":\"\/\/www.gravatar.com\/avatar\/2106622ee90d53d15ac1402806616aca?s=96&#038;r=g&#038;d=identicon\",\"contentUrl\":\"\/\/www.gravatar.com\/avatar\/2106622ee90d53d15ac1402806616aca?s=96&#038;r=g&#038;d=identicon\",\"caption\":\"Brajesh Singh\"},\"sameAs\":[\"http:\/\/buddydev.com\/members\/sbrajesh\/\",\"https:\/\/x.com\/sbrajesh\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to change the maximum upload file size for PHP &#8226; BuddyDev Help Center","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/buddydev.com\/docs\/general\/how-to-change-the-maximum-upload-file-size-for-php\/","og_locale":"en_US","og_type":"article","og_title":"How to change the maximum upload file size for PHP &#8226; BuddyDev Help Center","og_description":"To change the maximum upload file size for PHP, you need to modify two PHP configuration settings: `upload_max_filesize` and `post_max_size`. Here are the steps you can follow: Step 1:- Locate the PHP configuration file called `php.ini`. If you are not sure where this file is located, you can create a new PHP file with the ...","og_url":"https:\/\/buddydev.com\/docs\/general\/how-to-change-the-maximum-upload-file-size-for-php\/","og_site_name":"BuddyDev Help Center","article_published_time":"2023-05-01T08:52:19+00:00","og_image":[{"url":"https:\/\/buddydev.com\/docs\/files\/2023\/05\/php-ini-location-in-phpinfo-300x96.png","type":"","width":"","height":""}],"author":"Brajesh Singh","twitter_misc":{"Written by":"Brajesh Singh","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/buddydev.com\/docs\/general\/how-to-change-the-maximum-upload-file-size-for-php\/","url":"https:\/\/buddydev.com\/docs\/general\/how-to-change-the-maximum-upload-file-size-for-php\/","name":"How to change the maximum upload file size for PHP &#8226; BuddyDev Help Center","isPartOf":{"@id":"https:\/\/buddydev.com\/docs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/buddydev.com\/docs\/general\/how-to-change-the-maximum-upload-file-size-for-php\/#primaryimage"},"image":{"@id":"https:\/\/buddydev.com\/docs\/general\/how-to-change-the-maximum-upload-file-size-for-php\/#primaryimage"},"thumbnailUrl":"https:\/\/buddydev.com\/docs\/files\/2023\/05\/php-ini-location-in-phpinfo-300x96.png","datePublished":"2023-05-01T08:52:19+00:00","author":{"@id":"https:\/\/buddydev.com\/docs\/#\/schema\/person\/4ebf5f3e519f8cbddc6583e182dbe4fb"},"breadcrumb":{"@id":"https:\/\/buddydev.com\/docs\/general\/how-to-change-the-maximum-upload-file-size-for-php\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/buddydev.com\/docs\/general\/how-to-change-the-maximum-upload-file-size-for-php\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/buddydev.com\/docs\/general\/how-to-change-the-maximum-upload-file-size-for-php\/#primaryimage","url":"https:\/\/buddydev.com\/docs\/files\/2023\/05\/php-ini-location-in-phpinfo.png","contentUrl":"https:\/\/buddydev.com\/docs\/files\/2023\/05\/php-ini-location-in-phpinfo.png","width":969,"height":310},{"@type":"BreadcrumbList","@id":"https:\/\/buddydev.com\/docs\/general\/how-to-change-the-maximum-upload-file-size-for-php\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/buddydev.com\/docs\/"},{"@type":"ListItem","position":2,"name":"How to change the maximum upload file size for PHP"}]},{"@type":"WebSite","@id":"https:\/\/buddydev.com\/docs\/#website","url":"https:\/\/buddydev.com\/docs\/","name":"BuddyDev Help Center","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/buddydev.com\/docs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/buddydev.com\/docs\/#\/schema\/person\/4ebf5f3e519f8cbddc6583e182dbe4fb","name":"Brajesh Singh","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/buddydev.com\/docs\/#\/schema\/person\/image\/","url":"\/\/www.gravatar.com\/avatar\/2106622ee90d53d15ac1402806616aca?s=96&#038;r=g&#038;d=identicon","contentUrl":"\/\/www.gravatar.com\/avatar\/2106622ee90d53d15ac1402806616aca?s=96&#038;r=g&#038;d=identicon","caption":"Brajesh Singh"},"sameAs":["http:\/\/buddydev.com\/members\/sbrajesh\/","https:\/\/x.com\/sbrajesh"]}]}},"_links":{"self":[{"href":"https:\/\/buddydev.com\/docs\/wp-json\/wp\/v2\/posts\/3333","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/buddydev.com\/docs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/buddydev.com\/docs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/buddydev.com\/docs\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/buddydev.com\/docs\/wp-json\/wp\/v2\/comments?post=3333"}],"version-history":[{"count":5,"href":"https:\/\/buddydev.com\/docs\/wp-json\/wp\/v2\/posts\/3333\/revisions"}],"predecessor-version":[{"id":3339,"href":"https:\/\/buddydev.com\/docs\/wp-json\/wp\/v2\/posts\/3333\/revisions\/3339"}],"wp:attachment":[{"href":"https:\/\/buddydev.com\/docs\/wp-json\/wp\/v2\/media?parent=3333"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/buddydev.com\/docs\/wp-json\/wp\/v2\/categories?post=3333"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/buddydev.com\/docs\/wp-json\/wp\/v2\/tags?post=3333"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}