Home » Php » PHP How to find maximum allowed POST data?

PHP How to find maximum allowed POST data?

Posted by: admin July 12, 2020 Leave a comment

Questions:

In PHP, is there a quick way to find the maximum allowed size of POST data for any server configuration that my script is run on?

For example, $max_post_length = $_SERVER['maxpost']; or something. Perhaps it would return 0 for ‘no limit’…any ideas?

How to&Answers:

Use ini_get.

ini_get('post_max_size');

Answer:

Try this:

echo ini_get('post_max_size');

Or translate it to bytes:

echo (int)(str_replace('M', '', ini_get('post_max_size')) * 1024 * 1024);