On CPanel with Linux. I understand from the documentation that I can use php.ini or user.ini to increase the file upload size limit. The ini file looks like this:
file_uploads = On memory_limit = 128M post_max_size = 500M upload_max_filesize = 500M
Post editing,I've stopped the processes and restarted them too.
I've tried this under both filenames, but still get 413 error "The requested resource
does not allow request data with GET requests, or the amount of data provided in the request exceeds the capacity limit"
I can upload a file of less than 2MB, and my test file for this is 3.9 MB.
Any ideas what I'm doing wrong?
Solved! Go to Solution.
I'm not sure what this is, but it seems like a limit not set by the ini file. I did some research and found a suggestion that increasing the Apache LimitRequestBody limit might help. Try adding this to your .htaccess file:
The number you use should be whatever size you want but in bytes.
Thanks for this. I've been doing some digging and found a very useful article here which explains all of this:
My problem, is that I don't know how to edit the apache setting in the shared hosting. This URL above seems to indicate I should edit the .htaccess file, but I don't see one of those in my hosting. Should I?
The file you need with godaddy is user.ini ...but there is a cpanel setting that overrides it. Go to PHP Version, then when you get there, look for a link on the top rh corner that says switch to settings...there you can change all the settings. (well not all, cause it only has the basics here...but if these are set, the ini file won't over-ride them) ...and ignore that stupid ridiculous novice tag, it means nothing!
When I tried overriding the master php.ini with a php.ini or user.ini file, it failed. Killing processes did not work. Tech support, after a lot of pondering, helped me to find this solution:
Log in to Web Hosting > cPanel
Go to software and select "Select PHP version" to arrive at a page that list the PHP extensions
In the upper right corner, select "Switch to PHP options"
Here you can change most of the settings that users want to change.
I've been on the phone with GoDaddy for a long time today.
It ends up the shared hosting Apache server has a 1 Meg LimitRequestBody setting.
Since Apache is before PHP, Apache is the bottleneck, and in this case, PHP never gets my 3 Meg posts.
The shared hosting environment does not allow for form posts over 1 Meg, regardless of the downstream PHP settings. Ie: the PHP post_max_size and upload_max_filesize don't make a difference for form posts. When the form post is smaller, my PHP script DOES execute properly. Also, when I set LimitRequestBody to 3000 (3K), I can get my small form posts to fail with the same 413 error. So, I can make the limit smaller, but I cannot make the limit larger than 1 Meg.
My only option is to move to another hosting package such as a virtual private server.
Caveat: I was doing 3 Meg form posts, not file uploads. Out of curiosity, I HAVE been able to upload files above 1 Meg, but after multiple attempts I was only able to upload a 31 Meg file half way. Maybe it was encountering timeouts? I'm accepting the service limitation and moving on.
Thanks ! I have multiple sites in my server, and I didnt't have any .ini files. When I updated to php 7 it must have lost them ... I did it like you said on cpanel and select php version. Easy way to do it without getting into the server files manually !