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

From: Date: Tue, 22 Oct 2002 15:46:55 +0000
Subject: #20025 [Bgs]: header() not working correctly after session_start()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-23044@lists.php.net to get a copy of this message
ID: 20025 Updated by: hholzgra@php.net Reported By: jaco@premsoft.co.za Status: Bogus Bug Type: Session related Operating System: FreeBSD 4.7, Windows 2000 PHP Version: 4.3.0-pre1 New Comment: oh, yes ... IE's are not cacheing stuff that comes with nocache headers, which the session extension adds by default thats ok as long as IE can display the content right away, but if it is going to pass it to a plugin or trying to download and save it it passes on the name of a nonexistant local cache file ... for the lynx case: do you actualy have a readfile($dlfile) call or something like that in your code or is it really like in your examples? Previous Comments: ------------------------------------------------------------------------ [2002-10-22 10:35:07] sniper@php.net 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 ------------------------------------------------------------------------ [2002-10-22 09:19:57] jaco@premsoft.co.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 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=20025&edit=1

« previous php.bugs (#23044) next »