Forum Moderators: coopster

Message Too Old, No Replies

Uploading large files. htaccess changes don't seem to be working.

         

topwebdesigns

12:22 am on Nov 2, 2009 (gmt 0)

10+ Year Member



I'm trying to upload large files (upto 80mb) however I keep getting a "500 internal server error".

There are tons of threads around the forum with similar problems. Some are given the solution of adding lines to the htaccess file and this works and for others it doesn't and no further solution seems to be given. This is the case for me.

I've added the following lines to my htaccess file:

php_value post_max_size 150M
php_value upload_max_filesize 150M
php_value max_execution_time 800
php_value max_input_time 800

However a phpinfo shows this:

post_max_size 8M
upload_max_filesize 2M
max_execution_time 30
max_input_time 60

My phpinfo is in the same folder (httpdocs of a subdomain folder) as my .htaccess.

I am on a dedicated server over which I have full access and am not sharing it with anyone.

Can anyone suggest why it isn't working or offer another solution to allow me to upload large files with a 500 error?

rainborick

3:35 am on Nov 2, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



One reason these solutions will work on some sites and not others is that on many shared hosts, the timeout and other settings are controlled by the hosting service and cannot be overridden.

brotherhood of LAN

3:39 am on Nov 2, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I am on a dedicated server

Agreed rainborick, but topwebdesigns is on a dedicated server.

rocknbil

5:46 am on Nov 2, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome aboard TWD,

My phpinfo is in the same folder (httpdocs of a subdomain folder) as my .htaccess.

But where is the upload script located? If it's in a directory, move the .htaccess there and a copy of phpinfo to verify. When used in an .htaccess file, this is a per-directory control, which is a good thing.

Also, no possibility the .htaccess is erroring? (Usually gives a 500 if it is . . . )

You may find, even on a dedi, there is a reason for the 2MB limit in PHP. Even if PHP doesn't time out, the browser might as there are settings in user's browsers that determine how long to wait. Plus if you are doing any resizing, it will eat up memory fast - for a single process and a single user.

There are some other threads around that discuss a lot of these, try, in Google,

memory exhausted PHP site:webmasterworld
large upload PHP site:webmasterworld
iMagick PHP site:webmasterworld
fork PHP site:webmasterworld.com

The last will have some threads on what to do if you commit to letting it take forever to upload. Fork will allow you to return an immediate response and allow it to upload in the background.

topwebdesigns

8:51 am on Nov 2, 2009 (gmt 0)

10+ Year Member



Everything on my site works from index.php so I would presume the htaccess is required in the root, although the exact file (which is included) is located in applications/files/upload.php.

As for erroring all of my url rewrites work, so I wouldn't have thought the .htaccess was erroring.

I am trying to do more to the file, it's a zip file so I move_uploaded_file() to a folder called "originals" and then copy() a new location where I then use zipArchive to add extra licencing files to it (thus I can modify it but still keep a backup of exactly what was uploaded).

Also if it's rar file I extract it to a temp folder, re-archvive it in zip format and then destroy the temporary folder.

Although I would presume that the fact that my phpinfo is still showing the max upload limit to be 2MB is going to be the main problem.

I have thought that perhaps calling a shell script each time would be better, but I have absouletly no knowledge of this other than seeing it mentioned a few times here and there.

I've got what I consider to be a fairly beafy server with 2 x Dual Core 2.4Ghz processors and 8GB of RAM. I'm just moving over now and the script used to work fine on another server with just 2GB of RAM and a single 2.1Ghz Dual Core Processor.

rocknbil

5:29 pm on Nov 2, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



is located in applications/files/upload.php.

Did you try putting a small .htaccess in this directory with just the above code you posted? Worth a shot . . . though I agree, if it's included, should have worked for root.

EDIT: DOH! Just looked at one of my implementations. Try quoting?

php_value post_max_size "150M"
php_value upload_max_filesize "150M"
php_value max_execution_time "800"
php_value max_input_time "800"

topwebdesigns

6:46 pm on Nov 2, 2009 (gmt 0)

10+ Year Member



Well I figured out what it was of sorts. Although I can't offer the technical explanation as to why.

Basically, because my domain hadn't propagated to the new server yet I was using a sub domain of one of my other domains to access the site. I set this up using fast cgi in plesk as it was the only way I could get it to work.

For whatever reason when using this sub domain the htaccess changes weren't picked up, but once my domain had started pointing to the right place it worked fine.

Hopefully this helps someone else with a similar problem, sorry I can't be more specific as to the why's and hows.