Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP: Why does $_POST have a larger size limit than $_GET?

Tags:

post

I know that $_POST has a larger size limit than $_GET, but why? What is $_GET limited by?

like image 534
Leon Helmsley Avatar asked Dec 16 '22 11:12

Leon Helmsley


2 Answers

$_GET is transferred within the url and is therefore limited by its maximum size. Where there is no theoretical maximum url size defined with the HTTP standard, it is limited by many browsers and servers. Refer to this FAQ which advices your application to use urls that are smaller than 2000 chars

$_POST is transfererred within the request body which is also theoretical unlimited, but as with $_GET there are limits by browsers and servers. But they are usually much higher.

For you info: To adjust the maximum post size in php use the ini value

post_max_size=...
like image 68
hek2mgl Avatar answered Feb 27 '23 21:02

hek2mgl


This is the way HTTP was defined. GET is intended to be used mainly for getting data, whilst POST is for sending data.

Some details on limitations and differences: http://www.w3schools.com/tags/ref_httpmethods.asp

like image 44
Adam Szabo Avatar answered Feb 27 '23 23:02

Adam Szabo