Unable to upload large files on shared hosting? - php

I have shared hosting on godaddy. I am uploading a large video files upto 150 MB on server. It starts upload & upload some part of video upto 15% but after that connection is broken. I get below error
503 - SERVICE UNAVAILABLE
I have also manually configured the php.ini file below like
post_max_size = 512M
max_execution_time = 800
I am not sure if it is the programatically issue because i am able to upload small video on good connection. But as video size is large then i face the issue.
Kindly let me know what is the issue ?

Change your upload_max_filesize to the same amount as well
upload_max_filesize = 512M
post_max_size = 512M
You may need to increase your memory as well
memory_limit = 32M
Dont forget to restart your server after updating the php.ini file

If you are using an FTP connection for file upload , there is an option in the Filezilla to increase the wait time . Hope this works for you .

Related

Why can't I upload large files on my PHP website?

I am having a problem with uploading files bigger than a certain size (around 150MB/200MB) to my server.
Because I do not have this problem on my local server, I suspect it has something to do with settings on the shared server which I rent that runs Apache.
The error that I am getting is HTML error 413 Request Entity Too Large
Ofcourse I have done some research and found that the php settings on the server are set correctly as follows:
max_input_time = 24000
max_execution_time = 24000
upload_max_filesize = 2048M
post_max_size = 2048M
memory_limit = 4096M
max_input_vars = 2000
Furthermore, because the server runs on Apache, I made sure to also add
LimitRequestBody 2147483647 and
SSLRenegBufferSize 2147483647 to the .htaccess file which translate to 2GB for both settings.
For the code I just use the PHP move_uploaded_file($_FILES["video"]["tmp_name"], "../videos/". $newVideoName)) method which, one again, does work with smaller files.
Is anyone familiar with this problem or have any other solutions on how to fix this problem? I did talk the my host and they have said that there aren't any restriction on uploaded filesizes other than the PHP settings which I have changed.
Thanks upfront!

Upload big file using PHP

I'm trying to upload big files using PHP and it's not working and the size is around 855 ko. I've already tried uploading smaller files and its worked so i'm sure that my problem that causing the error.
I've already tried most of the solution in SO and google but in vain. Some said that i should try to configure my php.ini and i did but without success.
I'm using lighttpd on an embedded system.
My php.ini configuration :
max_execution_time = 300; Maximum execution time of each script, in seconds
max_input_time = 25200; Maximum amount of time each script may spend parsing request data
;max_input_nesting_level = 64 ; Maximum input variable nesting level
memory_limit = 40M ; Maximum amount of memory a script may consume (128MB)
file_uploads = On
upload_tmp_dir =/home/imagesdcard/www/
upload_max_filesize = 10M
max_file_uploads=2
I had tried many solutions that suggesting it was caused by certains configurations in php.ini and i had changed it but without success.So, i wanna ask how can i upload big files using php?
Thank you in advance for all advice and help and have a great day.
By configuration, PHP only allows to upload files up to a certain size. There are lots of articles around the web that explain how to modify this limit. Below are a few of them:
PHP Increase Upload File Size Limit
How do I increase the PHP upload limits?
For instance, you can edit your php.ini file and set:
memory_limit = 32M
upload_max_filesize = 24M
post_max_size = 32M
You will then need to restart apache.

Server issue with large file upload?

I have a dedicated server Linux WHM/Cpanel that hosts a video streaming website. I have a form to upload videos and I've been trying to upload larger files but failing? I've checked error logs and nothing is leading me in the right direction. Below are my php.ini settings
upload_max_filesize = 1200M
post_max_size = 1200M
max_input_vars = 1000
memory_limit = -1
max_file_uploads = 20
max_execution_time = 7200
max_input_time = 7200
max_input_vars = 1000
I can upload a 100MB file just fine but the movies i have can be up to 1gb. I'm using Plupload to upload files. I've tested several small size files and they upload fine. When I try to upload large movies e.g. 300mb, Plupload returns this error HTTP Error. Upload URL might be wrong or doesn't exist. and this is the only clue I have. Plupload uses chunking to split up large files also.
This only happens with larger files. It's really a nuisance also, since I have to upload large files all over again to see if my changes are successful or not.
Any ideas? Why would it work with a smaller size file but not larger? I have no errors to work from.
HTTP Error is common when there is something wrong with the files being uploaded. Please check your server info with php.ini
upload_max_filesize is the limit of any single file.
post_max_size is the limit of the entire body of the request,
Sometimes the server requires post_max_size greater than upload_max_filesize I might be wrong but I have to check.
Try debugging the issue removing the chunking first and then later add the chunking part when you remove those HTTP errors.

What settings do I need to upload a big amount of images? (php.ini)

I'm running a website which has a gallery. I want to add a function, which allows the user of the website to add a big amount of images (up to ~300). Because there are only a few users, which should be able to upload images, I'm currently helping them out by uploading them via FTP.
I've already implemented the function in PHP and it works on localhost, but because it's on localhost, it's "uploading" the images very fast and i have no real way to test, what happens, when you upload the images to a real webserver. (Internet connection to slow, timeout?)
Some settings in the php.ini are capped by my provider (max_execution_time, max_input_time, max_input_vars, memory_limit)
Is there a good way to handle this?
Webserver: Apache
PHP version: 5.5+
Other than those you may want to look at post_max_size and upload_max_filesize settings too to increase the file upload limit.
PHP has several configuration options to limit resources consumed by scripts. By default, PHP is set to allow uploads of files with a size of 2MB or less.
Try increasing the following values in php.ini, for example:
memory_limit = 32M
upload_max_filesize = 24M
post_max_size = 32M

Uploading files to server using php

I can successfully upload files upto 3-4 MB. But when I try to upload files greater than 4 MB, it starts upload for sometime and then shows "This webpage is not available" error. I have hosted the site in 000webhost. But in localhost, I can easily upload larger files as well. Please help me out of this.
You need to set the value of upload_max_filesize and post_max_size in your php.ini :
; Maximum allowed size for uploaded files.
upload_max_filesize = 40M
; Must be greater than or equal to upload_max_filesize
post_max_size = 40M
(and restart apache)
I believe that you have
Enough permission to upload files
And increased upload_max_filesize and post_max_size
upload_max_filesize = 40M
post_max_size = 40M
Note :
000webhost.com is a free hosting site and you can't expect good speed and it would fail in most cases. If you want to see good response better try in a paid hosting or try in some free app hosters like heroku
Update according to user's Comment :
I can do that in localhost. But where can I find the php.ini file as I have already hosted the site
You can't find the php.ini in online server. But you can set it using .htaccess files and other few ways..
Create a .htaccess file and inside it have the following code, then you can achieve your need.
php_value upload_max_filesize 40M
php_value post_max_size 40M

Categories