# PHP max\_file\_size is 20MB?

**URL:** <https://forum.infinityfree.com/t/php-max-file-size-is-20mb/83574>\
**Category:** Hosting Support\
**Created:** [September 30, 2023, 8:14pm UTC](https://forum.infinityfree.com/t/php-max-file-size-is-20mb/83574 "2023-09-30T20:14:35Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![lovebug](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/lovebug/32/57624_2.png) [@lovebug](https://forum.infinityfree.com/u/lovebug)\
**Post date:** [September 30, 2023, 8:14pm UTC](https://forum.infinityfree.com/t/php-max-file-size-is-20mb/83574/1 "2023-09-30T20:14:36Z")

</div>

[https://lovebyte.eu.org](https://lovebyte.eu.org)

I noticed that my site is now running PHP 8.2.11 and also noticed this  
**PHP max\_file\_size is 20MB**

should this be limited to 10MB ? or am I misunderstanding something here

---

<div class="post-metadata">

**Author:** ![solace-ken](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/solace-ken/32/29500_2.png) [@solace-ken](https://forum.infinityfree.com/u/solace-ken)\
**Post date:** [September 30, 2023, 9:04pm UTC](https://forum.infinityfree.com/t/php-max-file-size-is-20mb/83574/2 "2023-09-30T21:04:01Z")

</div>

There are 2 settings:

One in php.ini and one in Apache (httpd.conf)

The Apache config overrides the PHP setting.

---

<div class="post-metadata">

**Author:** ![lovebug](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/lovebug/32/57624_2.png) [@lovebug](https://forum.infinityfree.com/u/lovebug)\
**Post date:** [September 30, 2023, 9:08pm UTC](https://forum.infinityfree.com/t/php-max-file-size-is-20mb/83574/3 "2023-09-30T21:08:42Z")

</div>

so does this mean that php will allow a file of 20MB to be uploaded just for server to then delete it ?

---

<div class="post-metadata">

**Author:** ![solace-ken](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/solace-ken/32/29500_2.png) [@solace-ken](https://forum.infinityfree.com/u/solace-ken)\
**Post date:** [September 30, 2023, 9:09pm UTC](https://forum.infinityfree.com/t/php-max-file-size-is-20mb/83574/4 "2023-09-30T21:09:25Z")

</div>

Yeah, php tries to upload the file and then gives an error about Apache file size being set lower. The upload will fail.

---

<div class="post-metadata">

**Author:** ![lovebug](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/lovebug/32/57624_2.png) [@lovebug](https://forum.infinityfree.com/u/lovebug)\
**Post date:** [September 30, 2023, 9:10pm UTC](https://forum.infinityfree.com/t/php-max-file-size-is-20mb/83574/5 "2023-09-30T21:10:22Z")

</div>

would it not be better to configure this php value to 10MB instead of 20MB ?

---

<div class="post-metadata">

**Author:** ![solace-ken](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/solace-ken/32/29500_2.png) [@solace-ken](https://forum.infinityfree.com/u/solace-ken)\
**Post date:** [September 30, 2023, 9:10pm UTC](https://forum.infinityfree.com/t/php-max-file-size-is-20mb/83574/6 "2023-09-30T21:10:51Z")

</div>

It’s probably the default setting for PHP.

You have to do error handling in php on file uploads. I like to do client side file size checks with Javascript to avoid wasting resources.

---

<div class="post-metadata">

**Author:** ![lovebug](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/lovebug/32/57624_2.png) [@lovebug](https://forum.infinityfree.com/u/lovebug)\
**Post date:** [September 30, 2023, 9:11pm UTC](https://forum.infinityfree.com/t/php-max-file-size-is-20mb/83574/7 "2023-09-30T21:11:53Z")

</div>

it may possibly be the default, I think it would be better for the server if this was changed to 10MB

---

<div class="post-metadata">

**Author:** ![solace-ken](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/solace-ken/32/29500_2.png) [@solace-ken](https://forum.infinityfree.com/u/solace-ken)\
**Post date:** [September 30, 2023, 9:12pm UTC](https://forum.infinityfree.com/t/php-max-file-size-is-20mb/83574/8 "2023-09-30T21:12:10Z")

</div>

I agree

---

<div class="post-metadata">

**Author:** ![Admin](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/admin/32/36437_2.png) [@Admin](https://forum.infinityfree.com/u/Admin)\
**Post date:** [October 2, 2023, 1:29pm UTC](https://forum.infinityfree.com/t/php-max-file-size-is-20mb/83574/9 "2023-10-02T13:29:54Z")

</div>

> [@lovebug](#):
>
> I noticed that my site is now running PHP 8.2.11 and also noticed this  
> **PHP max\_file\_size is 20MB**
> 
> should this be limited to 10MB ? or am I misunderstanding something here

Not every uploaded file gets put on disk as-is. With these increased limits, you could upload a 16 MB ZIP file, extract it with PHP and write the extracted files to disk. This is especially useful for things like script/theme/plugin installations.

---

<div class="post-metadata">

**Author:** ![system](https://infinityfree-forum-uploads.s3.dualstack.eu-central-1.amazonaws.com/original/3X/b/0/b024fd3fa88bae093c9576e55c2c94e33f890206.svg) [@system](https://forum.infinityfree.com/u/system)\
**Post date:** [October 9, 2023, 1:30pm UTC](https://forum.infinityfree.com/t/php-max-file-size-is-20mb/83574/10 "2023-10-09T13:30:29Z")

</div>

Closed on October 9, 2023, 1:30pm UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
