Web Hosting Talk







View Full Version : PHP - Huge file uloads & apache mini HOWTO


modihost
01-05-2003, 08:40 AM
for a few months now i have been trying to figure out how to get big file transers working with http_upload and PHP.

The main problem is that by editing my php.ini file the changes are server-wide and i dont want that, because i only want the changes for one virtual host in apache for a special app that we are developing for a client.

So i had to find a way to make changes to the php.ini via the httpd.conf in the virtual host.


<virtualhost www.foobar.com>
ScriptAlias /cgi-bin/ /www/foobar/cgi-bin/
ScriptAlias /cgi-foobar/ /www/foobar/cgi-bin/
User foobar
Group foobargrp
ServerAdmin webmaster@foobar.com
ServerName www.foobar.com
ErrorDocument 404 /missing.html
DocumentRoot /www/foobar
TransferLog logs/foobar
</virtualhost>


If you have PHP4 installed and running as a module mod_php4 simply add this into the virtual server

# For HUGE file uploads - Blake Gardner
<IfModule mod_php4.c>
php_admin_value max_execution_time 0
php_admin_value max_input_time 0
php_admin_value memory_limit 8M
php_admin_value post_max_size 20M
php_admin_flag file_uploads On
php_admin_value upload_max_filesize 20M
</IfModule>
# End


it should all look like this



<virtualhost www.foobar.com>
ScriptAlias /cgi-bin/ /www/foobar/cgi-bin/
ScriptAlias /cgi-foobar/ /www/foobar/cgi-bin/
User foobar
Group foobargrp
ServerAdmin webmaster@foobar.com
ServerName www.foobar.com
ErrorDocument 404 /missing.html
DocumentRoot /www/foobar
TransferLog logs/foobar

<IfModule mod_php4.c>
php_admin_value max_execution_time 0
php_admin_value max_input_time 0
php_admin_value memory_limit 8M
php_admin_value post_max_size 20M
php_admin_flag file_uploads On
php_admin_value upload_max_filesize 20M
</IfModule>

</virtualhost>

those settings are for 20MB upload limit - i hope this solves someone else's problems!

Mekhu
01-05-2003, 10:46 AM
I just add this to my htaccess...

php_value upload_max_filesize 20M

Am I missing something something or did I misunderstand you?

modihost
01-05-2003, 07:14 PM
you config must be different somehow, because that dosent work on our server. I read that using .htaccess to change php values only works in php 3.x and php 4.x you have to use the httpd.conf.

Mekhu
01-06-2003, 12:52 AM
PHP Version 4.2.3

gambitdis
01-07-2003, 11:01 PM
What about browser timeouts? Most browsers time out after 2 minutes from what I've heard. With upstream cable modem bandwidth being tightly rate limited, isn't that the real problem?

Mekhu
01-09-2003, 01:23 PM
We haven't had any problems with timeouts and I've even upload 20mb through the browser, although I have heard of it...

Jeff

gambitdis
01-09-2003, 11:12 PM
Was that upload over the local network? I'd love to find a solution for our cable modem users who want to upload large files via their browsers. :)

modihost
01-13-2003, 01:34 AM
Originally posted by gambitdis
Was that upload over the local network? I'd love to find a solution for our cable modem users who want to upload large files via their browsers. :)


nope - to a remote web server - i even uploaded a 44MB file - with IE 6 and then with Mozilla 1.3A

The main reason of me posting this is because you dont need to change the php.ini - making the change server wide.

I think while i was reading Apache Docs, the MAX file size is 2GB - i might try it over our LAN at work and see how big i can get.

BTW: im running Apache/1.3.26 (Unix) PHP/4.2.1 FrontPage/5.0.2.2510 on Linux