Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Request Entity Too Large PHP

In one of my CakePHP site, I got this error.

Request Entity Too Large

I don't know what is the problem. I think the data that I am posting through form is too large. I searched this in search engine and got that I will have to increase post_max_size. Be default I think it is set to 8M.

But don't know how to increase post_max_size in CakePHP and what to do for it?

Thanks.

like image 679
gautamlakum Avatar asked Sep 15 '10 14:09

gautamlakum


People also ask

How do you handle 413 payload too large?

Nginx will throw the same 413::Request Entity is too large exception. It wont forward the request to your express app. So we need to set client_max_body_size 50M; in the nginx config OR a specific server config OR even a specific location tag will work.

What does HTTP Error 413 mean?

The HTTP 413 Payload Too Large response status code indicates that the request entity is larger than limits defined by server; the server might close the connection or return a Retry-After header field.


2 Answers

post_max_size and upload_max_filesize are PHP.ini settings. You can set them either directly in PHP.ini or via ini_set. I don't know if this can be set with some Cake-internal tools as well.

However, the error could also be caused by a set limit of the RequestBodyLength in Apache (assuming you are running under Apache).

like image 161
Gordon Avatar answered Oct 04 '22 08:10

Gordon


I tried all of these answers and the only thing that worked for me was to tune up the SSL Buffer Size. You can set this by...

<Directory /my/blah/blah>
...
  # Set this to something big big...
  SSLRenegBufferSize 10486000
...
</Directory>

...and then just restart Apache to take effect. (Found this at: http://forum.joomla.org/viewtopic.php?p=2085574)

like image 41
duskstriker Avatar answered Oct 04 '22 09:10

duskstriker