#20025 [NEW]: header() not working correctly after session_start()

From: Date: Tue, 22 Oct 2002 14:19:57 +0000
Subject: #20025 [NEW]: header() not working correctly after session_start()
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-23033@lists.php.net to get a copy of this message
From:             jaco@premsoft.co.za
Operating system: FreeBSD 4.7, Windows 2000
PHP version:      4.3.0-pre1
PHP Bug Type:     Session related
Bug description:  header() not working correctly after session_start()

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
-- 
Edit bug report at http://bugs.php.net/?id=20025&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=20025&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=20025&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=20025&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=20025&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=20025&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=20025&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=20025&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=20025&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=20025&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=20025&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=20025&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=20025&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=20025&r=isapi



Thread (3 messages)

« previous php.bugs (#23033) next »