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.
Related
I tried to upload file on wordpress but it didn't allow me to do so because the file size was larger than the limit.
After googling the problem, I accessed my website info through ssh and edited the php.ini file to increase the following settings:
upload_max_filesize = 512M
post_max_size = 512M
memory_limit = 512M
PS: I noticed that this also changed the info in the php-7.2.ini which seems to be an exact copy of php.ini.
After changing those settings I restarted httpd and went to my website. The upload limit was at 1M and I tried uploading the file again and it still didn't work...
I'm running out of possible solutions so if someone could help me out, that'd be awesome!
PS: I don't know if this matters but the wordpress I have is running with the multisite option ON. I only currently have 1 website on it.
Also don't know if this matters, but I also route my www.example.com domain to my example.com domain in Route 53 in AWS and read somewhere that the server might be creating 2 separate instances on the server. Adding the multisite functionality worked fine when I edited the wp-config.php file so I figured the double instance thing was not a problem but I'm still mentioning it here just in case.
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'm trying to upload files over 150MB with a PHP file, which works without any problem with files less than 40Mb. But when I try to upload files like 150 to 200 MB, it resets the upload process after uploading about half of the file.
It repeats again and again when the new upload process gets to same value, till the time limits on php.ini file kills the process.
The first thing I tried was increasing those values in my php.ini file:
post_max_size=450M
memory_limit=300M
max_execution_time=1600
max_input_time=1600
upload_max_filesize=400M
and file_uploads is of course set to On.
I also put this line to top of my upload.php file:
set_time_limit(0);
I'm running that website on Windows Server 2008 R2 with Parallels Plesk 12.0.8.
I search this problem on Google too much but none of the solutions work on my case.
I read the same scenario in this question, which the owner of the question replied that he solved the problem by increasing client_max_body_size value in nginx.conf file, but I could not find anything about this file in Windows server so I thought it is only exists on Linux systems.
What could cause this problem?
I've solved it.
I changed PHP's debugger from FastCGI Application to CGI Application on Plesk, and that solved it.
But be careful, it caused me a couple of errors in other pages of the website, and I've fixed them all again.
Hope that helps.
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"
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?