Error when uploading files larger than 500MB on vps server - php

I have a vps server (on hostinger) running on openlitespeed (cyberpanel). The website that I built uses PHP.
I created a file upload service and set my php config's post max limit to 1024M and upload max filesize to 1024M as well since both those settings work on my local when testing for large file uploads under 1gb. (I've also restarted php, as well as my server to see if it solved the issue but it still persists. I've also created a phpinfo file to confirm if my post max limit and upload max filesize were changed to 1024M/1G and they were changed)
But on my webserver, uploading files larger than 500mb gives me a "POST net::ERR_HTTP2_PROTOCOL_ERROR" on my console pointing to a line on one of my javascript code referring to my xhttp.send (specifically xhttp.send(formData) XML Http Request. This XML http request forwards the selected file to an upload.php script that processes the data. But it's not getting sent to that script due to the error.
When I get that error when uploading files larger than 500mb, I'd also get an error in my server's error log:
[NOTICE] [xxxx] [T0] [xx.xxx.xx.xxx:xxxxx:HTTP2-3#APVH_*:443_website.com] Request body size: <filesize> is too big!
The uploader works fine when uploading files under 500mb, it sends the formdata to the php upload script and stores it in the server as well as the database. But it gives an error when uploading more than that.
I've looked everywhere to solve this issue, I've also looked into openlitespeed's max request body size since it's seems like it's what the error on my error log shows, but most of the answers I've seen were from several years ago and no longer applies and didn't resolve the issue.
There doesn't seem to be any issue with my php script as well as my javascript from my tests since it works with no issues on my local server, and works fine with small file sizes on my web server.
Is there anyway to resolve this issue?

Related

Cannot Upload .GLB to Wordpress Media Location

This is not a quick failure, I have spent a totally of 5 completely full days trying to figure this out. Initially I was limited by file size and then file type; in which I removed the Wordpress restrictions and am now "capable" of uploading my 177MB .glb file to Wordpress.
However when doing so, I receive the following error:
retriever.glb
Unexpected response from the server. The file may have been uploaded successfully. Check in the Media Library or reload the page.
I was on the phone with GoDaddy Specialists for 2.5 hours yesterday ensuring that this was not a Server issue or restriction on their side.. they confirmed that it was not. We pretty much ended the conversation that it is something I must figure out with me, myself, and I.
I went ahead and uploaded my .glb to the server through panel, everything worked fine. In fact I have a location for it here: https://www.tattiniboots.com/wp-content/uploads/2020/07/retriever.glb
However, this does not make the file discoverable to the 3D viewer plugins I have installed on the site through the media location.
I truly don't know where to go from here
I changed the name of the file to .png and attempted an upload and received the following error:
Post-processing of the image failed likely because the server is busy or does not have enough resources. Uploading a smaller image may help. Suggested maximum size is 2500 pixels.
I just tried to update a normal .mov file that is 150MB and received the following error; really making me think this is something to do with file size:
Unexpected response from the server. The file may have been uploaded successfully. Check in the Media Library or reload the page.
Yes, normal images are uploading just fine (2MB-ish)
I just attempted to deactivate all plugins with consideration that maybe "Smush" or another was imposing issues: I then received the issue that the file type is not supported (even with the allow all file types code in my wp-config)
Is this just the case that glb is not allowed at all?
This must be a server thing. probably a run time error
Whoever supported you just doesn't know it. GoGoDaddy. ;)
Nevertheless... you can Use a plugin that's called
media sync. Check it out and best of luck

PHP POST upload of files > 8.2M fails

I am using the script posted here by w3school for uploading files to a webserver. I am using Google chrome going to an Apache server with php7.
When I upload a file from my windows desktop the script works as advertised and the file is uploaded. However when I attempt to upload a file from any other folder the $_FILES variable is either not there or it's values are empty (It actually appears to be a size issue, see edit below). I'm not sure how to troubleshoot this as the devtools on chrome don't seem to give me any information about what it is sending in this POST message.
I am assuming the problem is on the client side as it appears the server is getting no information from the client.
EDIT
I am aware of how to look at the headers for requests and nothing about the file except for its content length are included in the header. There is no difference between the headers that work and those that don't except the content boundary, which appears to be random, and the content-length header, which obviously changes with the size of the file.
I had a thought that this was related to the size of the file, and it is. I have a folder of different size photos and I sorted and uploaded increasingly larger files until it failed. It worked fine until around 8M files, and fails when they are larger than 8,200KB.
I checked the php.ini and I have it set to a max upload size of 150M, so it's not the ini file. I also check all the logs and nothing other than the post request shows up when I try to upload the file.
I was able to find the answer here: why would $_FILES be empty when uploading files to PHP.
I did not know there was a post_max_size option in the php.ini file, which was set to 8M. Now that this is set to 100M. If you go over this size of a POST request php does not parse the POST information, thus giving you a blank $_FILES variable.

Laravel - Uploading multiple images for a single request doesn't work well on shared host

I am uploading more than 12 images files for a single requests but the online server refuses to upload those images. In my local machine it works fine, i can upload more than 20 images at once. I have configured the PHP settings for max_file_uploads = 60, upload_max_filesize=100M, post_max_size = 125M in php.ini, both on my local machine server and online server. While sending the page loads unfinishing, and at the end after a long time it responds with a Network Protocol Error, which says that:
"An error occurred during a connection to www.mydomain.com. The page you are trying to view cannot be shown because an error in the network protocol was detected."
See the screen shots of other different error responses i've also got after many trials, and it still takes a long time of loading to get those responses after sending.
The images that i am uploading are being saved on server but not all. When i upload 20 images for a single request, it can get only 8 or 10 and sometimes the last image is cut short(interrupted) before it is fully uploaded, see its picture below.
I need to get all the images i am uploading like in my local machine, and with a quick response. What else i can do for configuration in PHP or elsewhere? What's wrong on shared hosting server? Please, if you have any answer to this, you can tell me what i can do, to get all uploaded images files with a quick response.
It's clearly because of a timeout error. It's not acceptable to send multiple files with one request. Even if you get it to work right now, it will fail from time to time depending on the user connection speed and file size. Also you mentioned a quick response. So you definitely need to use ajax upload to upload files simultaneously. There are multiple upload libraries such as dropzone.

Jquery file upload internal server error

I'm using Jquery File Upload to upload files around 30mb. I'm using the chunked option so the plugin breaks the file into 30, 1 mb pieces. Unfortunately on my remote server (shared hosting) I get an 500 Internal Server Error after about 10mb or 10 chucked POSTs to the PHP upload script.
The script works 100% on localhost, and also works on my remote server if the file is smaller which leads me to believe its not the code nor the plugin but rather my server. Any idea why this is happening? I can't imagine its an execution time limit as its not one request, but many smaller ones.

500 Internal Server Error When Uploading Images Using PHP

I'm offering users the ability to upload files using an online form, but I keep on getting 500 internal server errors whenever the file upload is processed. This is what I know:
The problem isn't related to php.ini. I've checked the max file upload size, and it's set at 2 megabytes. I get the same 500 internal server error uploading 3kb large files, as well as 100kb large files.
The problem isn't related to file permissions. The php file I'm using to upload, upload.php, has permissions set to 664, and the upload folder, called upload_pic, has folder permissions of 755.
This is not an issue with the code. The exact same code was working on my previous server. I recently bought a new server and am migrating the sites over, and this is where I'm getting my problem.
I've looked online for the past two days, but I just can't find what's causing the problem. I've seen many issues similar to mine, but most of these were resolved by changing file/directory permissions, or making edits to php.ini.
Does anyone have any other proposed solutions?
Thanks!

Categories