Headers - php3 v. php4

From: Date: Wed, 11 Oct 2000 20:22:37 +0000
Subject: Headers - php3 v. php4
Groups: php.general 
Request: Send a blank email to php-general+get-19694@lists.php.net to get a copy of this message
If it isn't supposed to work this way in php3, it is and I'm not sure why. Anyways... I have a function I use to get the user authentication information. If $PHP_AUTH_USER is not set, I send the 401 header and since the browser already has the auth info, it sends it to Apache and I'm then able to access both $PHP_AUTH_USER and $PHP_AUTH_PW. Now, in php3, I am able to use this function pretty much anywhere in the code, even at the bottom of the file after all of my echo statements. However, in php4, I get the error: "Warning: Cannot add header information - headers already sent by (output started at yadda yadda)" Why is my function working, where it is located in my code, in php3 but not php4? Is there any way that I can tell php4 to buffer all output until the very end of the file execution? Thanks! Chris

« previous php.general (#19694) next »