Re: !!Urgent .. Session Problem Solved ... But not completely

From: Date: Sat, 04 Sep 2004 13:10:32 +0000
Subject: Re: !!Urgent .. Session Problem Solved ... But not completely
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-195840@lists.php.net to get a copy of this message
believe me the FIRST line in the file is <?php session_start(); NOTHING AT ALL exists before it. but I still have the same error "M. Sokolewicz" <tularis@php.net> wrote in message news:20040904122330.97653.qmail@pb1.pair.com... > I think you didn't read all instructions we gave. One of them was to > remove all spaces and/or newlines BEFORE the first <?php tag in your > file, to save it and try again. > > anything before the <?php tag is considered HTML and thus output. Since > headers are always sent before the output is, they will be sent the > moment PHP notices the spaces and/or newlines. So, what happens is: > > PHP starts processing > PHP encounters spaces and/or newlines > PHP sends headers to the browser > PHP sends those spaces and/or newlines to the browser > PHP notices the <?php tag, and such swithed to "parsing-mode" > PHP notices session_start(); and thus tries to send a cookie (a cookie > is actually one of the headers) > PHP notices that headers have already been sent! So it gives an error, > because it can't "get them back and send them after the cookie again". > > So, remove the spaces and/or newlines before the <?php tag to fix this. > > Hope you get what to do now ;| > > - Tul > > Dre wrote: > > > thank u all .. > > I really did all of what u said but nothing worked !!!!!!!!!!!!! which was > > so so strange > > The problem was that the php.ini file I have got corrupted or something that > > the php.exe couldn't parse all of its values > > > > Any way thanks again .. > > Now I have another error with the same file and session > > the errors are as follows > > //===================================================== > > Warning: session_start(): Cannot send session cookie - headers already sent > > by (output started at C:\Program Files\Apache > > Group\Apache2\htdocs\ELBA\logme_in.php:1) in C:\Program Files\Apache > > Group\Apache2\htdocs\ELBA\logme_in.php on line 2 > > > > Warning: session_start(): Cannot send session cache limiter - headers > > already sent (output started at C:\Program Files\Apache > > Group\Apache2\htdocs\ELBA\logme_in.php:1) in C:\Program Files\Apache > > Group\Apache2\htdocs\ELBA\logme_in.php on line 2 > > > > //===================================================== > > > > > > "Dre" <dre00x@yahoo.com> wrote in message > > news:20040904080637.92239.qmail@pb1.pair.com... > > > >>Hi > >> > >>I'm trying to make a small login system on my website, I'm using > >> > >> Apache 2.0.49 for testing locally > >> and PHP 4.3.4 > >> on MS Windows XP Pro. > >> > >> the login script is in the file logme_in.php shown below > >> > >>//============================================================ > >> > >> <?php > >> session_start(); > >> include("db.php"); > >> > >> $username = trim(addslashes($_POST['user_name'])); > >> $pass = trim(addslashes($_POST['password'])); > >> > >> if((empty($_POST['user_name'])) || (empty($_POST['password']))) > >> { > >> > >> echo "enter username/password"; > >> } > >> > >> else{ > >> $sql = "SELECT * FROM members WHERE > >> user_name='".$username."' AND > >>password='".$pass."'"; > >> $result = mysql_query($sql); > >> $num_return = mysql_num_rows($result); > >> > >> if($num_return ==1) > >> { > >> $row = mysql_fetch_array($result); > >> session_register('uname'); > >> $_SESSION['uname'] = $username; > >> > >> } > >> else { > >> echo "invalid username/password"; > >> } > >> } > >> > >> ?> > >>//============================================================ > >> > >>The problem is that every time I try to login I keep have the following > >>error messages > >> > >> > > > > **************************************************************************** > > > >>****** > >>Warning: session_start(): open(/tmp\sess_2984f6d378560d0882f37728dbe1defc, > >>O_RDWR) failed: No such file or directory (2) in C:\Program Files\Apache > >>Group\Apache2\htdocs\ELBA\logme_in.php on line 3 > >> > >>Warning: session_start(): Cannot send session cookie - headers already > > > > sent > > > >>by (output started at C:\Program Files\Apache > >>Group\Apache2\htdocs\ELBA\logme_in.php:2) in C:\Program Files\Apache > >>Group\Apache2\htdocs\ELBA\logme_in.php on line 3 > >> > >>Warning: session_start(): Cannot send session cache limiter - headers > >>already sent (output started at C:\Program Files\Apache > >>Group\Apache2\htdocs\ELBA\logme_in.php:2) in C:\Program Files\Apache > >>Group\Apache2\htdocs\ELBA\logme_in.php on line 3 > >> > >>Warning: Unknown(): open(/tmp\sess_2984f6d378560d0882f37728dbe1defc, > > > > O_RDWR) > > > >>failed: No such file or directory (2) in Unknown on line 0 > >> > >>Warning: Unknown(): Failed to write session data (files). Please verify > > > > that > > > >>the current setting of session.save_path is correct (/tmp) in Unknown on > >>line 0 > >> > > > > **************************************************************************** > > > >>******* > >> > >>the session.save_path parameter in my php.ini file is as follows > >>************************************** > >>session.save_path = "C:/WINDOWS/Temp" > >>************************************** > >> > >>I'm kinda new at php and web development environment .. so any help will > > > > be > > > >>appreciated. > >> > >>Thanks in advance > >>Dre,

« previous php.general (#195840) next »