Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

downloadable products not downloading properly


tjazzvibe

Recommended Posts

would anyone have any idea why this is happening:

 

i buy a product go to the successful download page and there's the link to the downloadable file i just bought.

 

i click on the link and the file downloads very very quickly. the problem here is the file is 1 meg and should take longer than that.

 

i go to open the file (.pdf) and acrobat says it's corrupted.

 

i look at the file properties and it's 140 bytes.

 

so i'm getting the file but it's not complete. i've tried several files. i also download them via ftp program and they're ok and the right size.

 

sounds like to me that it's not the software but something with the settings on my server?

 

i did look all over for the answer here but could find nothing.

 

thanks for your time and help

tony miceli

Link to comment
Share on other sites

I am having the EXACT same problem with my stock install of OS Commerce and STS Plus v4.0.6 also installed STOCK. This problem happens if I have STS enabled or not, so I'm fairly sure it isn?t STS - and I've installed STS easily 20 times in the past 3 months while working on this site so I've gotten very good at installing it correctly - in case someone fears my install of STS Plus v4.0.6 might be the case.

 

What is your install? Is it stock? My OSC is v2.2ms2-051113

 

The funny thing about this is - this just started happening. I have NO idea what is up. For the past three months when I did get the downloads working (don?t even get me started on the 'download controller' contribution which I'm no longer even attempting to use) they worked fine.

 

My site deals with .mp3 files - of which they are all in the 12 to 24 megs size range, and my test file is 15.8megs. This file was downloading PERFECTLY for months... then today - blam 140k.

 

What in the WORLD?!

Link to comment
Share on other sites

so I'm fairly sure it isn?t STS - and I've installed STS easily 20 times in the past 3 months while working on this site so I've gotten very good at installing it correctly - in case someone fears my install of STS Plus v4.0.6 might be the case.

 

 

Ok.... ARG! Insert foot into mouth.

 

 

It seems that I had forgotten all my download tests which worked.... were done before actually uploading STS Plus v4.0.6 (and just tested again with v4.0.7) to my fresh/stock install of OS Commerce.

 

I have just verified that in MY case, it is in fact STS Plus v4.0.6 (or v4.0.7) that makes the downloads fail with the truncated file size bug we are both experiencing.

 

So - are there other people out there that use STS Plus v4.0.6 (or v4.0.7) and run a downloadable products store that can verify that THIER store's products download properly? If so, what custom code did you create and add to the php documents of the STS system in order to get it work again and can you please PLEASE paste that code here with instructions on how / where / what files to place it into.

 

 

It seems truly DUMBFOUNDING that STS Plus is incompatible with Downloadable Products... Can we please get some assistance from those who know about this scenario? And help would be SERIOUSLY appreciated! :)

Link to comment
Share on other sites

Once this rolls off the front page it's lights out.

 

Any one know about this or can point to a link that has solutions. I've been trolling the contribution thread for STS (which over 2000 posts mind you) as well as a multitude of posts and topics that are only somewhat related due to the way search is handled with this board system (although the +this +word +this +word +too funtion certianly helps).

 

Anyone?

Link to comment
Share on other sites

Try to check your web server error logs for any messages.

 

Also, rename the downloaded "shortened" file with a .txt extension and open it up in a text editor to see if there were any error messages rather than the actual download file.

 

Tom

Link to comment
Share on other sites

Amazingly even though I have to deal with file type mismatches ALLL the time (lots of mac to pc file situations) I honestly did not think to rename my little -what I thought was- corrupt file download to .txt:

 

this is what it says:

 

<br />

<b>Fatal error</b>: Allowed memory size of 8388608 bytes exhausted (tried to allocate 13199360 bytes) in <b>/home/virtual/site16/fst/var/www/html/download.php</b> on line <b>97</b><br />

 

I will check my server logs in about 30 minutes (have to fly to pick up my femme) and I'll paste here what I find as well.....

 

Given what I have so far - and knowing that is happens only when STS is installed what is the next step? (and good gosh man -woman?- thank you for the first steps of help with this!!!!)

Link to comment
Share on other sites

That isn't it - I just removed STS and completed my transaction with the clean OSC and my full 15.8 meg file downloaded perfectly and in full.

 

then I readded STS Plus v4.0.6 back on - immeadiatly did another purchase, the donwload link appears and blammo - failed file download.

Link to comment
Share on other sites

Just did another test. I went into the Admin console while STS was still installed (all of the files were still in the OS Commerce admin and catalog sides) I just disabled the "Template" so OSC was running on its own interface - and the download worked again, perfectly.

 

I can at will, change the template files from active to non active and break or fix the download file capability of my site's downloadable products.

 

I'll be looking for the server errors now if any in logs.... Where exactly would I look for these files? (Still somewhat new to PHP and Apache server side stuff - although I've learned tomes in the past 3 months)

Link to comment
Share on other sites

The text in the file that downloads when the system is broken (ie; when STS PLus v4.0.6 is running) that reffers to line 97 is reffering to this line:

 

readfile(DIR_FS_DOWNLOAD . $downloads['orders_products_filename']);

 

I just copied and pasted that out of my >/home/virtual/site16/fst/var/www/html/download.php file.

 

Now, on my server I have two error log files, one named "error_log" and another named "error_log.1" Alongside these two files are "access_log" and "access_log.1".

 

I've just gone and turned STS on again. Then starting as my computer's clock changed to 6:25pm 2006 started a new purchase process using IE 6 under Windows XP via a roadrunner net connection. The time at the sever is 3 hours behind me as we are on opposite coasts. From each of the logs here is what happened from the time I started that purchase (from the login point) until I downloaded the corrupted (or technically the error) file:

 

From access_log:

 

\par \\par 70.126.86.149 - - [10/Apr/2006:15:25:11 -0700] "GET /checkout_payment.php?osCsid=f0af98a065f1cb256971311fa4beb003 HTTP/1.1" 200 23520 "https://www.forcerecordings.com/login.php?osCsid=f0af98a065f1cb256971311fa4beb003" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)"

\par \\par 70.126.86.149 - - [10/Apr/2006:15:25:12 -0700] "GET /images/infobox/corner_right_left.gif HTTP/1.1" 404 327 "https://www.forcerecordings.com/checkout_payment.php?osCsid=f0af98a065f1cb256971311fa4beb003" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)"

\par \\par 70.126.86.149 - - [10/Apr/2006:15:25:12 -0700] "GET /includes/languages/english/images/buttons/button_change_address.gif HTTP/1.1" 200 1866 "https://www.forcerecordings.com/checkout_payment.php?osCsid=f0af98a065f1cb256971311fa4beb003" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)"

\par \\par 70.126.86.149 - - [10/Apr/2006:15:25:12 -0700] "GET /images/table_background_payment.gif HTTP/1.1" 200 1169 "https://www.forcerecordings.com/checkout_payment.php?osCsid=f0af98a065f1cb256971311fa4beb003" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)"

\par \\par 70.126.86.149 - - [10/Apr/2006:15:25:12 -0700] "GET /images/arrow_south_east.gif HTTP/1.1" 200 434 "https://www.forcerecordings.com/checkout_payment.php?osCsid=f0af98a065f1cb256971311fa4beb003" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)"

\par \\par 70.126.86.149 - - [10/Apr/2006:15:25:12 -0700] "GET /images/pixel_silver.gif HTTP/1.1" 200 35 "https://www.forcerecordings.com/checkout_payment.php?osCsid=f0af98a065f1cb256971311fa4beb003" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)"

\par \\par 70.126.86.149 - - [10/Apr/2006:15:25:12 -0700] "GET /images/checkout_bullet.gif HTTP/1.1" 200 533 "https://www.forcerecordings.com/checkout_payment.php?osCsid=f0af98a065f1cb256971311fa4beb003" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)"

\par \\par 70.126.86.149 - - [10/Apr/2006:15:25:13 -0700] "POST /checkout_confirmation.php?osCsid=f0af98a065f1cb256971311fa4beb003 HTTP/1.1" 200 22218 "https://www.forcerecordings.com/checkout_payment.php?osCsid=f0af98a065f1cb256971311fa4beb003" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)"

\par \\par 70.126.86.149 - - [10/Apr/2006:15:25:13 -0700] "GET /images/infobox/corner_right_left.gif HTTP/1.1" 404 327 "https://www.forcerecordings.com/checkout_confirmation.php?osCsid=f0af98a065f1cb256971311fa4beb003" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)"

\par \\par 70.126.86.149 - - [10/Apr/2006:15:25:13 -0700] "GET /images/table_background_confirmation.gif HTTP/1.1" 200 1238 "https://www.forcerecordings.com/checkout_confirmation.php?osCsid=f0af98a065f1cb256971311fa4beb003" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)"

\par \\par 70.126.86.149 - - [10/Apr/2006:15:25:13 -0700] "GET /includes/languages/english/images/buttons/button_confirm_order.gif HTTP/1.1" 200 1659 "https://www.forcerecordings.com/checkout_confirmation.php?osCsid=f0af98a065f1cb256971311fa4beb003" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)"

\par \\par 70.126.86.149 - - [10/Apr/2006:15:25:14 -0700] "POST /checkout_process.php?osCsid=f0af98a065f1cb256971311fa4beb003 HTTP/1.1" 302 - "https://www.forcerecordings.com/checkout_confirmation.php?osCsid=f0af98a065f1cb256971311fa4beb003" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)"

\par \\par 70.126.86.149 - - [10/Apr/2006:15:25:18 -0700] "GET /checkout_success.php?osCsid=f0af98a065f1cb256971311fa4beb003 HTTP/1.1" 200 19163 "https://www.forcerecordings.com/checkout_confirmation.php?osCsid=f0af98a065f1cb256971311fa4beb003" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)"

\par \\par 70.126.86.149 - - [10/Apr/2006:15:25:18 -0700] "GET /images/infobox/corner_right_left.gif HTTP/1.1" 404 327 "https://www.forcerecordings.com/checkout_success.php?osCsid=f0af98a065f1cb256971311fa4beb003" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)"

\par \\par 70.126.86.149 - - [10/Apr/2006:15:25:18 -0700] "GET /images/table_background_man_on_board.gif HTTP/1.1" 200 9559 "https://www.forcerecordings.com/checkout_success.php?osCsid=f0af98a065f1cb256971311fa4beb003" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)"

\par \\par 70.126.86.149 - - [10/Apr/2006:15:25:20 -0700] "GET /download.php?order=27&id=22&osCsid=f0af98a065f1cb256971311fa4beb003 HTTP/1.1" 200 195 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)"

 

 

From error_log:

 

[Mon Apr 10 15:25:01 2006] [error] [client 70.126.86.149] File does not exist: /home/virtual/site16/fst/var/www/html/images/infobox, referer: https://www.forcerecordings.com/login.php?o...971311fa4beb003

[Mon Apr 10 15:25:12 2006] [error] [client 70.126.86.149] File does not exist: /home/virtual/site16/fst/var/www/html/images/infobox, referer: https://www.forcerecordings.com/checkout_pa...971311fa4beb003

[Mon Apr 10 15:25:13 2006] [error] [client 70.126.86.149] File does not exist: /home/virtual/site16/fst/var/www/html/images/infobox, referer: https://www.forcerecordings.com/checkout_co...971311fa4beb003

[Mon Apr 10 15:25:18 2006] [error] [client 70.126.86.149] File does not exist: /home/virtual/site16/fst/var/www/html/images/infobox, referer: https://www.forcerecordings.com/checkout_su...971311fa4beb003

 

 

 

 

Is this enough info to track down WHY STS PLUS v4.0.6 IS BREAKING DOWNLOADABLE PRODUCTS?

 

If there is anything - and I do mean ANYTHING at all I can provide anyone with in order to figure this one out just say jump and I'll say how high ok? :)

 

 

Um... and anything else I can think of before I wait for a reply.... My downloads are set to not use redirect.......my STS has been tested and confirmed to break OS Commerce both with the stock *test* template and a completely custom one designed by myself named "force"......... the payment method is currently set to COD or money order with the check confirmation for that payment type set to "delivered" so downloads will instantly show up while I test the site......the store can be located here and I've got STS running so the downloads are broken:

 

http://www.forcerecordings.com/index.php

 

The purchase process obviously doesn?t cost you any money so feel free to beat on the store and see if any bugs fall out for you look at.

Link to comment
Share on other sites

Should I create a new thread for this possibly? This seems like an imensly large issue that obviously effects many many people as STS Plus is on the top 5 downloaded contributions for OSC.

Link to comment
Share on other sites

Just did another test. I went into the Admin console while STS was still installed (all of the files were still in the OS Commerce admin and catalog sides) I just disabled the "Template" so OSC was running on its own interface - and the download worked again, perfectly.

 

I can at will, change the template files from active to non active and break or fix the download file capability of my site's downloadable products.

 

I'll be looking for the server errors now if any in logs.... Where exactly would I look for these files? (Still somewhat new to PHP and Apache server side stuff - although I've learned tomes in the past 3 months)

 

I don't think it is a problem with STS.

 

Let's step back and look at basics.

 

With standard osc the download.php runs fine and no memory problems.

 

Add STS (which does add substantial overhead to osc) and the download.php fails with a PHP error message encapsulated within the download file.

 

I really think you should try to up the 8mb "memory_limit" and see what happens.

 

Tom

Link to comment
Share on other sites

I'm feeling that you?re probably right in some way that I'm unaware of yet... Like I said I'm learning as I go.

 

If this is however the reason why with STS installed and enabled that downloads do not work - then although it?s not entirely STS's fault, it still is partially its fault (due to the overhead it creates). If this is the case, specific information regarding php settings needs be added to the STS contribution that will solve what can or already is a wide spread issue for download sales stores.

 

And hey - if this is what it is, then you and I can actually be the ones to have found that fix information and contribute back to the contribution! :)

 

Let me go and get some research on this done. I'll be back with everything I find.

 

Thank you AGAIN for the continual words as I move along on this.

Link to comment
Share on other sites

In relation to the memory_limit - this appears to be a server side PHP setting. It should be noted that I'm hosted on www.mediatemple.net and via a shared server (which was probably evident by reading the path the error and logs gave). But I thought I'd mention that just in case because I may or my not be able to increase or modify that setting.

 

Also, if this file is 12.6 megabytes (I changed the file out with one slightly smaller incase anyone is wondering) then it alone is more than the 8 meg limit of the server (if that is what's going on). Knowing this, why would a file already beyond the 8 meg limit server properly without STS and not with STS?

 

And even more - just how much overhead DOES sts add? Good lord, if it's like more than 8 megs of overhead... WHAT IN THE WORLD?! :D

 

Next steps? I'm personally looking into the line 97 readfile line to see if there any thing that can be done about how the file is read and served. I've also got a friend that is (to me) a GOD of PHP and I'll be inquiring with him about that line as well from the download.php file to see if there are alternatives to how the file is served up.

Link to comment
Share on other sites

OK, I give up, you don't want to change the memory limit via your ISP. This has solved the problem on this error message thousands of times. Just google on the web.

 

You can surmise all you wish that it won't fix it or that your file is 12mbs. Up the limit on the server and chances are it will work. If your ISP won't or can't then pay more for a server that will support it. 8mbs is bare minimum and memory is cheap.

Link to comment
Share on other sites

STS PLUS adds some overhead, like every contribution, but not a lot, and less than STS. I just tried to download a 2MB file using an STS PLUS store and no problem. Try also with a small file, like 1MB zip file and tell us the result.

 

- Rigadin

Link to comment
Share on other sites

Just something I thought now. When we speak about the 8MB limit, it is actually the maximum memory allocated for a script to run, but does it involve file downloads?

 

When STS/STS PLUS is running, the result of the code is not sent to the browser but buffered. Is it possible that the file to download goes somehow to the buffer, reaching then the memory limit? For now this is my only explanation to the fact that big files can be downloaded when STS PLUS is off. As STS v2/v3 is always buffering the output, even when turned off, the problem should always happen.

 

I will try to reproduce the problem on my host.

 

- Rigadin

Link to comment
Share on other sites

OK, I give up, you don't want to change the memory limit via your ISP. This has solved the problem on this error message thousands of times. Just google on the web.

 

You can surmise all you wish that it won't fix it or that your file is 12mbs. Up the limit on the server and chances are it will work. If your ISP won't or can't then pay more for a server that will support it. 8mbs is bare minimum and memory is cheap.

 

There is always more than one way to solve a problem. And when it deals with a Contribution ALL FOCUS should be set on improving the code of said contribution so that it's users are not forced to *pay more* for it's use.

 

As it happen - we fixed the problem that STS Plus v4.0.6 creates, and here is how:

 

Open download.php from your catalog root.

 

Go to the bottom the document and find the line:

readfile(DIR_FS_DOWNLOAD . $downloads['orders_products_filename']);

 

Comment out that line and just below it place this instead:

 

$chunksize = 1*(1024*1024);

$buffer = '';

$cnt = 0;

$handle = fopen(DIR_FS_DOWNLOAD . $downloads['orders_products_filename'], 'rb');

while (!feof($handle)) {

$buffer = fread($handle, $chunksize);

echo $buffer;

ob_flush();

flush();

}

fclose($handle);

 

 

STS Error/problem/breakage fixed.

 

Also, if you want to increase the speed of the downloaded file you can up the $chunksize = 1*(1024*1024); setting. Change the 1 to 2, or 3, or ect. until it breaks and then ratchet it down one notch and your good to go.

 

I appreciate all of your help getting me to this point OceanRanch - had you not been so stubborn that it was STS that was the problem - I'd have never been pushed to prove it was, and how to fix it :) J/K, seriously though, I'm the type that gets a good push to work harder from others throwing up their hands - and with that and your earlier help which REALLY did make all of this possible (finding the error in the first place) we now have a solution.

 

I'll add this as a contribution amendment as soon as I can so that everyone can fix their STS Plus install if they don?t want to pay for more expensive hosting instead. Particularly this will be useful to those running STS Plus on shared server accounts.

Link to comment
Share on other sites

had you not been so stubborn that it was STS that was the problem

 

I meant to say "not/wasn't"... Had you not been so stubborn that it wasn?t STS Plus's fault. Speed typing can get ya every time.

Link to comment
Share on other sites

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...