Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

session var problem

Status
Not open for further replies.

derketa

Programmer
May 13, 2002
43
0
0
TR
Hi all,

I am trying to pass some variables across pages by session method.like:

session_start();
..
session_register("sUserName");
...

it gives these errors:
Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/domains/web-

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/domains/web-


I searched the forum and saw there are others having the same problem.
And it is clearly explained in that replies that i need to define my storage files or edit php.ini file.(i don't know where)

Also i saw a method to define the path like:
session.save_path = c:\php\sessiondata

i tried this but did not work because i am working on a remote server.

What can i do?
Where is this php.ini file?


thanks a lot.
 
session_start(); should be before everything else including HTML, does this help?
 
Sorry I didn’t read the last bit, the session save path is just where php will save its information until it needs it but it sounds like your problem is to do with the session_start appearing in the script too late. The session save path can be changed to a file on the web server that you have access to, I think but I have never worked remotely sorry.
 
my code is like this:
<body>
<?php
session_start();
session_register("sUserName");
if ((!$_POST[user_id]) OR (!$_POST[pass]) )
{
echo "Error";
$error=1;
?>

<a href="pm.htm">Back</a>
<?php
}
?>
...
..
<?PHP $sUserName = $HTTP_POST_VARS['pass'];?>


still gives the same error but this time before directing the page.
 
ok everything else including html:)))
i stand corrected.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top