What is the maximum file upload size allowed in the post_max_size
and upload_max_filesize
configuration options (in PHP 5.3)?
-
the maximum file size we can configure in post_max_size and upload_max_filesize variables in php 5.3 – Shanaka Nov 03 '11 at 05:54
2 Answers
According to the manual entry about post_max_size
:
Note:
PHP allows shortcuts for bit values, including K (kilo), M (mega) and G (giga). PHP will do the conversions automatically if you use any of these. Be careful not to exceed the 32 bit signed integer limit (if you're using 32bit versions) as it will cause your script to fail.
Your limit could be 32bit signed integer limit. ~2,147,483,647 bytes on a 32 bit version. See the PHP_INT_MAX
constant to get the value for your system:
PHP_INT_MAX (integer)
The largest integer supported in this build of PHP. Usually int(2147483647). Available since PHP 4.4.0 and PHP 5.0.5
Related:
-
So that means though it is php 5.2 or 5.3 the maximum size is 2,147,483,647 bytes for 32 bit versions right? – Shanaka Nov 03 '11 at 05:59
-
yep. It basically takes an input of type `integer`. So depending on your php platform, the max value will differ. See [this](http://www.php.net/manual/en/language.types.integer.php) – abhinav Nov 03 '11 at 06:01
-
Is there any way that I can install 64 bit php version on ubuntu 9.10 server? – Shanaka Nov 03 '11 at 06:05
-
1If you're compiling it, then the process is the same. I'm sorry I should have been clearer. I meant, on a 64bit platform(your os and hardware) the `interger` max value will differ from the 32bit platform. If you're able to compile php from source, then your integer value should automatically be to the tune of `9e18` on a 64bit platform. Take care when installing from binaries, you'll need a 64bit version. – abhinav Nov 03 '11 at 06:13
-
Yes My server is a ubuntu 9.10 64 bit one. Any recommendation giude for compiling php source on ubuntu 64 bit server? Thanks for your help – Shanaka Nov 03 '11 at 06:35
There is no real limit set by PHP to post_max_size or upload_max_filesize. However both values must be smaller than memory_limit (also you can modify this). Anyway, as values use something (a lot) smaller than your RAM. A hacker may attempt to send a very large file that will consume completely your system resources. To upload large file is better to use an FTP server.

- 11
- 3
-
Yes that is the main issue I talked with my client. But he wants this to be done. Thanks for your input – Shanaka Nov 03 '11 at 07:26