|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-10-22 09:19 UTC] jaco at premsoft dot co dot za
Hi all.
[description]
I experience a problem that the header() function does not work correctly after session_start is called. What I am trying to achive is to download a file, using header().
[/description]
[code]
The following code works:
<?php
$dlfile = "./temp.zip";
header("Content-Type: application/download-script-by-hex\n");
header("Content-Disposition: attachment; filename=\"$dlfile\"");
header("Content-Transfer-Encoding: binary");
?>
The following code fails:
<?php
session_start();
$dlfile = "./temp.zip";
header("Content-Type: application/download-script-by-hex\n");
header("Content-Disposition: attachment; filename=\"$dlfile\"");
header("Content-Transfer-Encoding: binary");
?>
[/code]
[errors]
I also set the value of session.track_sid to 0, (as advised in Bug #19991), with no luck.
When I access this page with IE 6.00.2600.0000, running on Windows 2000, it givies `Internet Explorer is unable to open this Internet site'.
When I use Lynx, running on FreeBSD 4.7, I can download the file, but I receive a 4 byte ascii file, containing nothing but spaces.
The file I am trying to download is a 387 byte zipped file.
[/errors]
[setup]
The PHP installation runs on FreeBSD 4.7, together with Apache 1.3.27.
[PHP Configure options]
./configure --with-openssl --with-mysql=/usr/local/mysql --with-trans-sid --enable-sockets --with-apxs=/usr/local/apache/bin/apxs
Please note that I have tried this setup with both PHP 4.2.3 and PHP 4.3.0-Pre1, both with setting session.trans_sid=1 and session.trans_sid=0 set in the config file.
[/PHP Configure options]
[setup]
Regards
Jaco van Tonder
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Wed Apr 22 14:00:01 2026 UTC |
This is not PHP bug but a bug in IE 6. (I just fought 2 hours with this very same problem this morning..:) The fix was to either change 'session.cache_limiter = public' in php.ini or do same using session_cache_limiter('public'); before session_start(); in the script. And those headers you're sending are not really correct either..check the manual page for header() function and the user comments there.. If you're using SSL then this might also be needed: http://www.extremetech.com/article/0,3396,s=201&a=24899,00.asp and: http://www.modssl.org/docs/2.8/ssl_faq.html#ToC49