Zen Cart Logo
Forums / General Questions / Downloads timing out

Downloads timing out

Locked

Views: 1,919

Results 1 to 17 of 17
This thread is locked. New replies are disabled.
27 Jan 2009, 2:25 AM
#1
dancemad avatar

dancemad

New Zenner

Join Date:
Jan 2009
Posts:
12
Plugin Contributions:
0

Downloads timing out

Hi all,

My site consists of downloadable files only of which some are 200 megs in size. The downloads seem to be timing out at about 15 to 20 megs or 60 seconds . If I buy-pass the store and url directly to the file, it downloads just fine.

I have the latest version of Zencart and it is a fresh install on ipower.com.

I believe I have all my ducks in a row with the file attributes etc. I do have a green dot on the attributes box.

Any ideas?

Thanks
Michael

27 Jan 2009, 5:51 AM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Downloads timing out

The downloads seem to be timing out at about 15 to 20 megs or 60 seconds
Go to admin > tools > server ver info > and search the resulting page for "max_execution_time" and you will most likely see "60"

If your host allows you to have your own php.ini file then you can add & alter this with a reasonable but higher value:

max_execution_time = 60     ; Maximum execution time of each script, in seconds

Might be against the terms of service on a shared host using the resources for extended times??

27 Jan 2009, 7:23 AM
#3
dancemad avatar

dancemad

New Zenner

Join Date:
Jan 2009
Posts:
12
Plugin Contributions:
0

Re: Downloads timing out

Ok, I seem to have found that in the PHP core. Do you know where to find that file? Thanks tons, I've been working on this forever.....;-)

27 Jan 2009, 8:08 AM
#4
dancemad avatar

dancemad

New Zenner

Join Date:
Jan 2009
Posts:
12
Plugin Contributions:
0

Re: Downloads timing out

OK, I found the script editor for the PHP.ini file on my server, however after changing the max execution time.....then go back and look at the server info in Zen.....the local time remained 60 but the Master value changed to what I wanted. When testing, I still have the interupted download at the time of the local.

27 Jan 2009, 1:07 PM
#5
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Downloads timing out

Using FTP, check to see if you have a php.ini file at the root of your ZenCart install or any in your account area. As you have a differing local value you must.
It is in this file you will need to alter these settings.

27 Jan 2009, 8:09 PM
#6
dancemad avatar

dancemad

New Zenner

Join Date:
Jan 2009
Posts:
12
Plugin Contributions:
0

Re: Downloads timing out

Nothing in the root. By accounts, would that be IN the zen cart somewhere?

27 Jan 2009, 9:53 PM
#7
dancemad avatar

dancemad

New Zenner

Join Date:
Jan 2009
Posts:
12
Plugin Contributions:
0

Re: Downloads timing out

OK, it seems I was able to get both local and master values to 1200 seconds on max_execution_time, unfortunatly, I still get my downloads timing out. ughhhh

27 Jan 2009, 10:04 PM
#8
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Downloads timing out

The PHP max_execution_time setting has no impact whatsoever unless you have "download by streaming" enabled and "download by redirect" disabled. Those are not the default settings. The only time PHP actually serves the downloads byte-by-byte is when streaming mode is enabled. The rest of the time it's handled by apache.

Historically, download timeouts are almost always a server-side problem. Sometimes turning off GZip compression via your Admin->Configuration menu has provided some relief.

Download Delivery Methods Explained:
https://www.zen-cart.com/tutorials/index.php?article=292

27 Jan 2009, 10:27 PM
#9
dancemad avatar

dancemad

New Zenner

Join Date:
Jan 2009
Posts:
12
Plugin Contributions:
0

Re: Downloads timing out

This is great I am learning so much. My next question would be, why can I download without interuptions if I URL directly to this file and not download succesfully going through the cart?

27 Jan 2009, 10:40 PM
#10
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Downloads timing out

Likely a permissions problem with the redirect or a GZip problem conflicting with your server config.

27 Jan 2009, 10:41 PM
#11
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Downloads timing out

Perhaps you might enlighten us on how you've got it set up ...

27 Jan 2009, 10:51 PM
#12
dancemad avatar

dancemad

New Zenner

Join Date:
Jan 2009
Posts:
12
Plugin Contributions:
0

Re: Downloads timing out

However, I am not redirecting (false) and I am not compressing (false)

27 Jan 2009, 11:05 PM
#13
dancemad avatar

dancemad

New Zenner

Join Date:
Jan 2009
Posts:
12
Plugin Contributions:
0

Re: Downloads timing out

Well, I turned off Gzip and redirect, turned on streaming and the problem still exists.....ugh

29 Jan 2009, 6:01 AM
#14
dancemad avatar

dancemad

New Zenner

Join Date:
Jan 2009
Posts:
12
Plugin Contributions:
0

Re: Downloads timing out

Here is what my isp (ipower.com) sent back after troubleshooting this issue.

To overcome this, please use header() function to redirect the request to the browser, to download the file. Currently, you are getting an pop-up download box which shows the progress bar. This is of Windows. You can have a progress bar built incorporated in the site itself, to show the progress. This way you can stop the download from timing out as this script will be refreshing the same. Please take the help of your web master.

If anyone knows what he is talking about, I would be indebted forever.

Michael

29 Jan 2009, 6:39 AM
#15
dancemad avatar

dancemad

New Zenner

Join Date:
Jan 2009
Posts:
12
Plugin Contributions:
0

Re: Downloads timing out

Here is the code from download.php

// Now send the file with even more header() magic;-)
// Date in the past
header("Expires: Mon, 26 Nov 1962 00:00:00 GMT");
// always modified
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
// HTTP/1.1
header("Cache-Control: private, no-store, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false); // false=don't overwrite but add header
// HTTP/1.0

// Content stuff
header("Content-Length: " . filesize(DIR_FS_DOWNLOAD . $downloads['orders_products_filename']));
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename="" . $downloads['orders_products_filename'] . """);

if (DOWNLOAD_BY_REDIRECT == 'true') {
// This will work only on Unix/Linux hosts
tep_unlink_temp_dir(DIR_FS_DOWNLOAD_PUBLIC);
$tempdir = tep_random_name();
umask(0000);
mkdir(DIR_FS_DOWNLOAD_PUBLIC . $tempdir, 0777);
symlink(DIR_FS_DOWNLOAD . $downloads['orders_products_filename'], DIR_FS_DOWNLOAD_PUBLIC . $tempdir . '/' . $downloads['orders_products_filename']);
if (file_exists(DIR_FS_DOWNLOAD_PUBLIC . $tempdir . '/' . $downloads['orders_products_filename'])) {
tep_redirect(tep_href_link(DIR_WS_DOWNLOAD_PUBLIC . $tempdir . '/' . $downloads['orders_products_filename']));
}
}

// Fallback to readfile() delivery method. This will work on all systems, but will need considerable resources
readfile(DIR_FS_DOWNLOAD . $downloads['orders_products_filename']);
?>

29 Jan 2009, 8:21 AM
#16
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Downloads timing out

Zen Cart already uses header() commands to do the redirected downloads.

29 Jan 2009, 8:23 AM
#17
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Downloads timing out

dancemad:

Here is the code from download.php

...
if (DOWNLOAD_BY_REDIRECT == 'true') {
// This will work only on Unix/Linux hosts
tep_unlink_temp_dir(DIR_FS_DOWNLOAD_PUBLIC);
$tempdir = tep_random_name/COLOR;
umask(0000);
mkdir(DIR_FS_DOWNLOAD_PUBLIC . $tempdir, 0777);
symlink(DIR_FS_DOWNLOAD . $downloads['orders_products_filename'], DIR_FS_DOWNLOAD_PUBLIC . $tempdir . '/' . $downloads['orders_products_filename']);
if (file_exists(DIR_FS_DOWNLOAD_PUBLIC . $tempdir . '/' . $downloads['orders_products_filename'])) {
[COLOR="Red"]tep_redirect
(tep_href_link(DIR_WS_DOWNLOAD_PUBLIC . $tempdir . '/' . $downloads['orders_products_filename']));
}
}

// Fallback to readfile() delivery method. This will work on all systems, but will need considerable resources
readfile(DIR_FS_DOWNLOAD . $downloads['orders_products_filename']);
?>

Um ... you have osCommerce code in there instead of Zen Cart code.
Zen Cart does not have or use any "tep_xxxxxx()" functions.

Perhaps you've installed incompatible addons?
Or attempted to hack code from different software?

Please contact whoever made the customizations on/for your site for support.