Re: Error when trying to get global variables

From: Date: Thu, 13 Jan 2005 15:13:02 +0000
Subject: Re: Error when trying to get global variables
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-25306@lists.php.net to get a copy of this message
Louis Young wrote:
Hi there I've used a tool called asp2php to convert all my asp files to php files, but now in ASP you have the global.asa file. I've converted this to global.php. So now part of it looks as follows:
It actually worked? Cool!
function Application_OnStart() { extract($GLOBALS); $Application["ConnectionString"]="PROVIDER=SQLOLEDB;DATA SOURCE=MYDB;UID=myuser;PWD=mypwd;DATABASE=mydb"; return $function_ret; } Now from one of the other pages: <? include "global.php"; session_start(); session_register("Login_session"); session_register("Outlet_session"); echo $Application["ConnectionString"]; ?> But I get the following warning: *Warning*: session_start(): Cannot send session cache limiter - headers already sent (output started at C:\Program Files\Apache Group\Apache2\htdocs\spar\admin\global.php:52) in *C:\Program Files\Apache Group\Apache2\htdocs\spar\admin\login.php* on line *3
Unless you are specifically doing a header() call this is caused by sending output to stdout.
On line 52 in global.php there is nothing. This is the end of the file.
Is there a line of blank text at the end of the code? This has been known to cause this problem and while it isn't obvious from viewing your code... it's being sent as content. Or at least this is oftentimes what causes this error. -- Teach a person to fish... Ask smart questions: http://www.catb.org/~esr/faqs/smart-questions.html PHP Manual: http://www.php.net/manual/en/index.php php-general archives: http://marc.theaimsgroup.com/?l=php-general&w=2

« previous php.windows (#25306) next »