Background: I'm planning on using the JW FLV Media Player for streaming some videos:
http://www.longtailvideo.com/players/jw-flv-player/
Question: What settings, both PHP globals and php.ini, would I need to change in order to handle the uploading of large video files?
Sub-question: Is there anyway, through maybe the .htaccess file, that I could have the settings only apply to a single domain? I host several of my websites on the same server, and let's say if I changed the execution timeout to a few minutes for videos I wouldn't someone else on one of my other sites to have to wait through that kind of timeout for a regular upload if an error should occur.
In .htaccess this will let you upload a 20MB file, and increase time for the script to 200 seconds. Most shared hosting won't let you do this though, and will keep a global limit.
php_value upload_max_filesize 20M
php_value post_max_size 20M
php_value max_execution_time 200
php_value max_input_time 200
Related
I have problem in multiple file upload in php. I have set php.ini setting in .htaccess file
php upload_max_filesize 1024M
php post_max_size 1024M
php max_execution_time 120
php max_input_time 120
php max_file_uploads 40
So when I upload images approx 40M size then server respond with status failed or connection reset instead of it upload images within 1 min time .If I upload little less than 40M then its working fine.Is there any other setting I have to do. How I can fix this issue.
Most likely you're running against the clock or have conflicting settings, but it's hard to tell with the amount of information you provided.
Even though you set up your PHP instance to accept uploads of up to 1024M (are you sure you need this, by the way?) there's a lot more you need to consider:
php max_execution_time 120
php max_input_time 120
The above means that whatever happens, your PHP instances will be stopped after 120 seconds. It may be that you are able to upload almost 40M in under 120 seconds.
Now, even if you had a connection speed that allows to upload more than 40M in less than 120 seconds, there's more settings thay may be conflicting, as the above ones only apply to the PHP process.
Check your Apache settings (I assume you use Apache given the tag on your question) and look for Apache's directives regarding execution times and upload limits. Even if PHP was configured to allow 1 Terabyte per file and 24 hours per process, if Apache has more restrictive limits, Apache will be constraining your upload sizes and running times.
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
hello all i am having a dedicated server and even after increasing the max_upload size and memory limit i can not upload videos of larger size please check the image
i have a dedicated server from bluehost and the site is like video hosting site so i need to allow almost all file sizes but till now i have alloed max_file size arround 900 mbs but i can not upload files more than 10-20 mb please let me know if there is anything that i should do on my behalf.
By default, PHP permits a maximum file upload of 2MB. You can ask users to resize their images before uploading but let’s face it: they won’t. Fortunately, we can increase the limit when necessary.
Two PHP configuration options control the maximum upload size: upload_max_filesize and post_max_size. Both can be set to, say, “10M” for 10 megabyte file sizes.
However, you also need to consider the time it takes to complete an upload. PHP scripts normally time-out after 30 seconds, but a 10MB file would take at least 3 minutes to upload on a healthy broadband connection (remember that upload speeds are typically five times slower than download speeds). In addition, manipulating or saving an uploaded image may also cause script time-outs. We therefore need to set PHP’s max_input_time and max_execution_time to something like 300 (5 minutes specified in seconds).
These options can be set in your server’s php.ini configuration file so that they apply to all your applications. Alternatively, if you’re using Apache, you can configure the settings in your application’s .htaccess file:
php_value upload_max_filesize 10M
php_value post_max_size 10M
php_value max_input_time 300
php_value max_execution_time 300
I am facing a read timeout problem from couple of days.
There is a facility to upload users in my application (Xls,xlsx are allowed extensions). This is completely admin panel.
I am using PHPExcel for reading the data from the sheet and inserting each row details into database on the fly.
Here, there is a possibility to upload large size files. Right now the file I am having is 16MB file which contains nearly 200k records.
I have increased below configurations through htaccess
php_value memory_limit 1024M
php_value max_execution_time 259200
php_value max_input_time 3000
php_value post_max_size 700M
php_value upload_max_filesize 100M
I have placed set_time_limit(0) in the specific controller also.
My problem is read timeout in production environment. It is executing for around 15 mins and returning the below error
The requested URL could not be retrieved
While trying to retrieve the URL: http://example.com/upload/url
The following error was encountered:
Read Timeout
The system returned:
[No Error]
A Timeout occurred while waiting to read data from the network. The network or server may be down or congested. Please retry your request.
Will Keep Alive do something here. It is set to 5 in production and Apache timeout is 300.
I have searched many of the similar errors post in this site but no luck
I am planing to set a cron job, uploading the files only from front end. Hope that will solve this but I also want to know what factor is causing this error.
I've made a tiny site where my friends can upload songs and some tiny files that they want to but my problem is that files over 5mb fails, as in the browser shows "Connection reset" error.
The max file size set by my server is 2Mb, but i can upload 2.5-3Mb fine
Probably because i overwrote it with .htaccess
But however file uploads over 5Mb they just don't get uploaded at all, as i said earlier browser cannot reach server.
Would this be a server issue? Or an issue in my code? Will i need to change things in order for large uploads to happen?
Also max post size and max file size is set to 40mb in the .htaccess file
Here is the website
http://sharebay.webatu.com/
You can try uploading some files over 7mb, mp3/flac/aac/m4a/wav/
Add these to .htaccess as well (adjust 10M to size in MB that you want):
php_value upload_max_filesize 10M
php_value post_max_size 10M
This assumes you don't have access to php.ini (otherwise it would be better to put there) and that your host does not prohibit htaccess overrides on these values.
If you've already tried that then post more info about your environment. If you are on a shared server it's probably not something you can change too much.
How long the upload takes?
If you have slow upload line then it should take more time then max_execution_time and then apache halts your PHP script.
Change file upload size
You can change it an .htaccess file.
.htaccess files are stored in the same directory as your .php files are. They modify configuration for that folder and all sub-folders. You simply use them by creating an .htaccess file in the directory of your choice (or modify it if present).
The following should enable you to increase your upload limit (if the server provider allows PHP config changes via .htaccess).
php_value upload_max_filesize 70M
php_value post_max_size 80M
php_value memory_limit 90M
php_value max_execution_time 240
php_value max_input_time 240
you can change size according ur need