PHP max_file_size is 20MB?

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

1 Like

There are 2 settings:

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

The Apache config overrides the PHP setting.

5 Likes

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

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

1 Like

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

1 Like

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.

1 Like

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

I agree

1 Like

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.

6 Likes

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