I have been getting this 413 response when trying to upload an ~20MB zip file with a home grown (but not by me) document library resource developed in PHP running on an Apache server with a MySQL database connected. Normally the max file size is limited to 5.2MB in a local PHP variable. So the first thing I did was to increase this value and try to upload the file. That's the first time I encountered this error.
I tried everything mentioned here: Request Entity Too Large
And even changed the mod_security config settings mentioned in the bottom of that post. Even with all the limits I found raised far above what I should need -- up to ~120MB, I still get this error.
This worked fine for me maybe this helps you to upload larger files:
Change these values in php.ini:
upload_max_filesize 3000M
post_max_size 3000M
max_execution_time 3600
max_input_time 3600
So after posting this, I found another mod_security limit that needed to be raised appropriately.
SecRequestBodyLimit was too low (131072).
This is probably a corner case, but hope it helps someone else.
Do you increase LimitRequestBody in your apache config? Link to LimitRequestBody in Apache Documentation
None of the listed fixed my problem. They were all set much higher than needed. I was posting 100k-500k textarea fields. What did fix it for me was adding the following to the <form> tag.
enctype="multipart/form-data"
Related
My environment is a shared hosting package by 1und1 (1and1). Locally on my laptop, everything works fine.
I'm sending quite a large AJAX request to the server (~1.2MB) which worked fine for a long time now. However, a few days ago it stopped working and I keep getting the following response:
413 Request Entity Too Large
The requested resource
[my request URL] does not allow
request data with POST requests, or the amount of data provided in the
request exceeds the capacity limit.
When I lower the size of the POST parameter (a long JSON-string), then everything works as expected. The limit is somewhere around 1MB (determined by trial and error).
I've found a lot of suggestions what the cause could be. E.g. the following php config values. However, they are more liberal than the ones on my local machine and I cannot see where they could be a limit here:
max_input_time = -1
max_execution_time = 50000
upload_max_filesize = 64M
post_max_size = 64M
memory_limit = 256M
Then, another config value often appears in solutions, the apache config LimitRequestBody. The problem here is: AFAIK I don't have acccess to changing it on the 1and1 shared hosting - and I cannot find a way to view the apache error log...
I initially thought that the LimitRequestBody must be the cause.
But why can I upload files via a normal POST HTML file form then (tested with a 4MB file) on the same server (using the Symfony 2 form builder with a filetype object which seems to translate into a standard HTML file upload form)? As far was I understand the LimitRequestBody (and if applicable also SecRequestBodyNoFilesLimit) value, it should also cause the same error here, if it really was the cause, right?
So does anyone has another idea what I could do to debug this error any further? Or has a solution to my question above? Or at least any ideas how to workaround this?
PS:
SSLRenegBufferSize should not be relevant when accessing the webpage without https, right?
413 errors occur when the request body is larger than the server is configured to allow, and there is only so much you can do especially if the server it not under your control. Here’s is an idea:
Ask your hosting company to set the LimitRequestBody directive in either your httpd.conf file or a local .htaccess file to be higher. More Info
I am developing a web application which will allow the administrator to upload a file and its max size is 500M.
I have changed the post_max_size = 500M and upload_max_filesize = 500M from 32M but the funny thing is that it does not allow me to upload files greater than 32M still.
I have restarted the server and everything and still cant get to upload a large file.
Is there any other setting i should change to allow me to upload the file?
I am not going to process the file in memory but move it to the tmp folder and than process from there with move_uploaded_file so memory_limit i am assuming that is not going to be affected.
It is a simple form and as i recall if the limit is exceeded in the $_FILES superglobal array i should see something in the error element of the array but instead i get an empty array.
EDIT: I am modifying the php.ini settings but from phpinfo i am still getting the sizes of 32MB. And the php error log says that obviously i am exceeding 32MB
Can you please help me out.
Thanks
Chech phpinfo() on a web page, see which php.ini is loaded. You could be editing the wrong file.
Sometimes different ini files get loaded for command line and apache server use
I fount out what the problem is:
I am using MAMP as a developing server and MAMP has templates which override the original every time the server starts (a stupid thing IMO) so you need to change the template for it to take effect!
The template can be found under /Applications/Mamp Pro/Contents/Resources
And there many php ini files for every version will be found.
Hope this helps to the next one!
I am using a server hosted by GoDaddy, But when I post data of size greater than 1MB it returns a 413 "Request Entity Too Large" response. I cannot find the httpd.conf file and cannot affect the .htaccess changes. How can I increase the LimitRequestBody to 50MB.
I am using shared hosting.
Here's a screenshot of the response I get:
If you are having shared hosting plan with godaddy, as of right now, I just tested, maximum LimitRequestBody have to be set at 500kb.
Seems like used to be 1MB.
And, based on what I googled, you need to move to the dedicated server in order to modify these settings.
I would say the problem lies in your php configuration. There are two settings for file size limitation:
upload_max_filesize = 10M
post_max_size = 10M
These settings are normally found in the php.ini file. Since I have no experience with your kind of hosting I would not know if you can change it, but if you have access to the php.ini or have some other means of overriding php settings you can follow this post on StackOverflow on how to do this.
By running phpinfo you can at least find out what the current settings are and see if this is causing the issue.
Here is how to increase the file size limit in your PHP.ini file: https://support.godaddy.com/help/article/1409/increasing-user-file-upload-limits-using-php-ini-on-your-linux-server
I've been stuck on this for about a week and I just seem to be going around in circles.
The problem is receiving a 500 Internal Server error when uploading files. I've posted around a few forums but help is extremely limited due to me running a Windows Server.
So what have I done so far?
Checked, double checked, triple checked the PHP.INI file to make sure I have all the correct attributes set:
max_execution_time 600
max_input_time 600
memory_limit 128M
post_max_size 50M
upload_max_filesize 50M
Checked over the script and decided to test a few different scripts from various sources W3Schools, PHP.net etc same problem.
Upgraded PHP5 to PHP5.3 same issue
Tried to implement it using the JQuery_File_Upload API and I got unstable results. Rarely it would upload >10MB files and almost always threw out a Internal Server Error
Checked the error log. I checked it but nothing out of the ordinary in there and last write was a few days ago so I added a custom log and again, nothing being written to it.
What else can I do? I'm running a dedicated server, Windows 2008, Plesk.
Please help!
Thanks.
I resolved this issue by checking the /var/log/apache2/error_log files. Saw something there that indicated that a.htaccess file was being read, so i went to that dir and opened the .htaccess file:
server/php/files/.htaccess
Then commented out the below line by putting a hash in front of it:
Header set X-Content-Type-Options "nosniff"
Then browsed to the directory and it worked fine.
This has been grinding my gears for at least a week now.
I have a site which has a crucial function - the upload component. Without it, the site is completely useless.
Now, lots of users have problems uploading files. This is why I implemented a log system that keeps track of what happens when the file is on the server.
Problem is, only a minority of problems happen when the file is on the server, the problems happen client side.
For example, when I tried SWFUpload the errors where 'I/O Error'. When I changed to Uploadify I get 'HTTP Error'. I am trying to get a more detailed error description as I type this.
I am starting to think its not the client or the upload software, but the server. What could be wrong? The following directives for PHP are set:
upload_max_filesize 200M
post_max_size 200M
memory_limit 256M
max_execution_time 4200
max_input_time 4200
I simply have no clue why file uploads are failing. They should not fail. I would really appreciate any answers as why the uploads could be failing.
Thank you.
Are you using enctype="multipart/form-data" as an attribute in your HTML form element?