Re: [PHP] File download by php header...

2003-07-22 Thread Scott Fletcher
Found the problem.  It is the odbc_connect() that cause the download to fall
short of completing it's download.  Weird!  I think it's because the
database connection have a slower response time than the download response
time.  PHP header should not be affected by the odbc function...  But then I
remember about the past problem with the CGI Error when it come to php
header function and odbc which I don't have this problem with ISAPI.  Funny
I'm getting this problem, but fortunately, the workaround is to do the odbc
connection after I use the php header and that took care of it.

Curt Zirzow [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 * Thus wrote Scott Fletcher ([EMAIL PROTECTED]):
  Hi!
 
  I'm using PHP 4.3.2 and IIS 5.0.  I'm using the PHP header to
  cause the webserver to download the file to the web browser.  Some
  of the time it work and some of the other time, it doesnt.  I
  haven't figured out why until I looked in the error log which
  showed hte problem...   See two clipping below.
 
  --snip-- //Send Downloadable File(s) To Browsers...
  $total=$DownloadUpdateArray[$_REQUEST['dw_code']][0]; header
  (Content-Type: application/octet-stream); header (Content-Length:
  .filesize($total)); header (Content-Disposition: attachment;
  filename=.$DownloadUpdateArray[$_REQUEST['dw_code']][1]);
  readfile($total); --snip--
 
  --snip-- [21-Jul-2003 09:15:33] PHP Fatal error:  Maximum execution
  time of 30 seconds exceeded in D:\filepath\menu\tech_support.php
  on line 47 --snip
 
  So, how does the php header(content-disposition:attachment;
  filename='***') cause the php timeout in the first place, what
  seem to be the problem?

 It doesn't.  Your script is taking over 30 seconds to run you will need
 to find out why and where its taking to long or extend your time-out
 setting.

 btw, also on the content-disposition, not only will some browsers not
 honor that, they will just use the name of the script as the 'save-as'
 filename.

 Curt
 -- 
 I used to think I was indecisive, but now I'm not so sure.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] File download by php header...

2003-07-21 Thread Scott Fletcher
Hi!

I'm using PHP 4.3.2 and IIS 5.0.  I'm using the PHP header to cause the
webserver to download the file to the web browser.  Some of the time it work
and some of the other time, it doesnt.  I haven't figured out why until I
looked in the error log which showed hte problem...   See two clipping
below.

--snip--
  //Send Downloadable File(s) To Browsers...
$total=$DownloadUpdateArray[$_REQUEST['dw_code']][0];
header (Content-Type: application/octet-stream);
header (Content-Length: .filesize($total));
header (Content-Disposition: attachment;
filename=.$DownloadUpdateArray[$_REQUEST['dw_code']][1]);
readfile($total);
--snip--

--snip--
[21-Jul-2003 09:15:33] PHP Fatal error:  Maximum execution time of 30
seconds exceeded in
D:\filepath\menu\tech_support.php on line 47
--snip

So, how does the php header(content-disposition:attachment;
filename='***') cause the php timeout in the first place, what seem to be
the problem?

Thanks,
 Scott



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] File download by php header...

2003-07-21 Thread Chris Hayes
At 16:15 21-7-03, you wrote:
Hi!

I'm using PHP 4.3.2 and IIS 5.0.  I'm using the PHP header to cause the
webserver to download the file to the web browser.  Some of the time it work
and some of the other time, it doesnt.  I haven't figured out why until I
looked in the error log which showed hte problem...   See two clipping
below.
--snip--
  //Send Downloadable File(s) To Browsers...
$total=$DownloadUpdateArray[$_REQUEST['dw_code']][0];
header (Content-Type: application/octet-stream);
header (Content-Length: .filesize($total));
header (Content-Disposition: attachment;
filename=.$DownloadUpdateArray[$_REQUEST['dw_code']][1]);
readfile($total);
--snip--
--snip--
[21-Jul-2003 09:15:33] PHP Fatal error:  Maximum execution time of 30
seconds exceeded in
D:\filepath\menu\tech_support.php on line 47
--snip
So, how does the php header(content-disposition:attachment;
filename='***') cause the php timeout in the first place, what seem to be
the problem?
It seems like $DownloadUpdateArray[$_REQUEST['dw_code']][1] takes so long. 
Or the previous code alwyas takes 29.9 secs, who knows.

You can tell php.ini that scripts can take some time longer dan 30 secs, or 
you can add a line to prolong the script time 
(http://nl2.php.net/function.set-time-limit) or you can try to make that 
function faster.

I have some extra headers to prevent several problems:

header(Expires: Mon, 26 Jul 1997 05:00:00 GMT);   // Date in 
the past
header(Last-Modified:  . gmdate(D, d M Y H:i:s) .  GMT);  // always 
modified
header(Cache-Control: no-store, no-cache, must-revalidate);   // HTTP/1.1
header(Cache-Control: post-check=0, pre-check=0, false);
header(Pragma: no-cache); // HTTP/1.0

header(Content-type: text/csv);   //adapt to 
your file type
header('Content-Disposition: inline; filename=filename.ext');

Note that internet explorer 5.5 does not accept the 'attachment' part so 
for your header with 'attachement;' in it consider to add this conditional:
if (strstr($_SERVER[HTTP_USER_AGENT],MSIE 5.5)) {$att = ;} else {$att 
=  attachment;;}






Thanks,
 Scott


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] File download by php header...

2003-07-21 Thread Curt Zirzow
* Thus wrote Scott Fletcher ([EMAIL PROTECTED]):
 Hi!
 
 I'm using PHP 4.3.2 and IIS 5.0.  I'm using the PHP header to
 cause the webserver to download the file to the web browser.  Some
 of the time it work and some of the other time, it doesnt.  I
 haven't figured out why until I looked in the error log which
 showed hte problem...   See two clipping below.
 
 --snip-- //Send Downloadable File(s) To Browsers...
 $total=$DownloadUpdateArray[$_REQUEST['dw_code']][0]; header
 (Content-Type: application/octet-stream); header (Content-Length:
 .filesize($total)); header (Content-Disposition: attachment;
 filename=.$DownloadUpdateArray[$_REQUEST['dw_code']][1]);
 readfile($total); --snip--
 
 --snip-- [21-Jul-2003 09:15:33] PHP Fatal error:  Maximum execution
 time of 30 seconds exceeded in D:\filepath\menu\tech_support.php
 on line 47 --snip
 
 So, how does the php header(content-disposition:attachment;
 filename='***') cause the php timeout in the first place, what
 seem to be the problem?

It doesn't.  Your script is taking over 30 seconds to run you will need
to find out why and where its taking to long or extend your time-out
setting.

btw, also on the content-disposition, not only will some browsers not
honor that, they will just use the name of the script as the 'save-as'
filename.  

Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] File download by php header...

2003-07-21 Thread Scott Fletcher
Um, problem is I don't have any scripts before this sample header function.
So, something is up.  Does the file size 49 MB have something to do with it?

Okay, saw both of the replies, so will check them out.

Thanks,
 Scott

Curt Zirzow [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 * Thus wrote Scott Fletcher ([EMAIL PROTECTED]):
  Hi!
 
  I'm using PHP 4.3.2 and IIS 5.0.  I'm using the PHP header to
  cause the webserver to download the file to the web browser.  Some
  of the time it work and some of the other time, it doesnt.  I
  haven't figured out why until I looked in the error log which
  showed hte problem...   See two clipping below.
 
  --snip-- //Send Downloadable File(s) To Browsers...
  $total=$DownloadUpdateArray[$_REQUEST['dw_code']][0]; header
  (Content-Type: application/octet-stream); header (Content-Length:
  .filesize($total)); header (Content-Disposition: attachment;
  filename=.$DownloadUpdateArray[$_REQUEST['dw_code']][1]);
  readfile($total); --snip--
 
  --snip-- [21-Jul-2003 09:15:33] PHP Fatal error:  Maximum execution
  time of 30 seconds exceeded in D:\filepath\menu\tech_support.php
  on line 47 --snip
 
  So, how does the php header(content-disposition:attachment;
  filename='***') cause the php timeout in the first place, what
  seem to be the problem?

 It doesn't.  Your script is taking over 30 seconds to run you will need
 to find out why and where its taking to long or extend your time-out
 setting.

 btw, also on the content-disposition, not only will some browsers not
 honor that, they will just use the name of the script as the 'save-as'
 filename.

 Curt
 -- 
 I used to think I was indecisive, but now I'm not so sure.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] File download by php header...

2003-07-21 Thread Scott Fletcher
 btw, also on the content-disposition, not only will some browsers not
 honor that, they will just use the name of the script as the 'save-as'
 filename.

That's okay with the 'save as' filename because no one know hte real
filename on the webserver because it is renamed when it is download anyway.

Curt Zirzow [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 * Thus wrote Scott Fletcher ([EMAIL PROTECTED]):
  Hi!
 
  I'm using PHP 4.3.2 and IIS 5.0.  I'm using the PHP header to
  cause the webserver to download the file to the web browser.  Some
  of the time it work and some of the other time, it doesnt.  I
  haven't figured out why until I looked in the error log which
  showed hte problem...   See two clipping below.
 
  --snip-- //Send Downloadable File(s) To Browsers...
  $total=$DownloadUpdateArray[$_REQUEST['dw_code']][0]; header
  (Content-Type: application/octet-stream); header (Content-Length:
  .filesize($total)); header (Content-Disposition: attachment;
  filename=.$DownloadUpdateArray[$_REQUEST['dw_code']][1]);
  readfile($total); --snip--
 
  --snip-- [21-Jul-2003 09:15:33] PHP Fatal error:  Maximum execution
  time of 30 seconds exceeded in D:\filepath\menu\tech_support.php
  on line 47 --snip
 
  So, how does the php header(content-disposition:attachment;
  filename='***') cause the php timeout in the first place, what
  seem to be the problem?

 It doesn't.  Your script is taking over 30 seconds to run you will need
 to find out why and where its taking to long or extend your time-out
 setting.

 btw, also on the content-disposition, not only will some browsers not
 honor that, they will just use the name of the script as the 'save-as'
 filename.

 Curt
 -- 
 I used to think I was indecisive, but now I'm not so sure.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php