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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question about sessions 1

Status
Not open for further replies.

NVSbe

Programmer
Sep 9, 2002
153
BE
I was adviced, a while back, to be sure to use session variables instead of the url string. I'm attempting this now, in one page, for instance:

TEST.PHP
<?php
session_start();
if (!$_SESSION[&quot;reload&quot;]) {
$reload=&quot;test&quot;;
echo &quot;no reload&quot;;
$_SESSION[&quot;reload&quot;]= $reload;
}
else {
echo &quot; reload&quot; ;
$tmp = $_SESSION[&quot;reload&quot;];
echo $tmp;
}
?>


Basically, if it's the first time showing the site, I'd like to read: &quot;No reload&quot;, and from then on: &quot;Reload Test&quot;. I get a number of errors I don't understand..

Warning: session_start(): open(/tmp\sess_fc42323c9240fb9b372116136c61cc9f, O_RDWR) failed: No such file or directory (2) in c:\Inetpub\ on line 2

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at c:\Inetpub\ in c:\Inetpub\ on line 2

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at c:\Inetpub\ in c:\Inetpub\ on line 2
no reload
Warning: Unknown(): open(/tmp\sess_fc42323c9240fb9b372116136c61cc9f, 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


--------------------------------------
It's not the monsters under your bed, it is the men next door.
That make you fear, make you cry. Make you cry for the Child.
All the wars are fought amongst those lonely men. Unharmed, unscarred.
 
The first error message refers to the path where the session vars are stored. Check out the settings for the path where that temp folder is - also you need to make sure that you/the webserver/user as whom PHP runs has write and read access.

The second message appears because the first message was output. Sessions send a chache limiter header. Header always have to be the very first output. Since the error message was already sent the error occurs.

The third message is just like the first - no access to the session file folder.

It actually says right there:
Please verify that the current setting of session.save_path is correct (/tmp)[/code]

Sessions are written in small temporary files on the server. Alternatively you can implement a database based session handling system.
 
Thank you. I changed the temp setting in the php.ini file to point to another folder, and it worked...

--------------------------------------
It's not the monsters under your bed, it is the men next door.
That make you fear, make you cry. Make you cry for the Child.
All the wars are fought amongst those lonely men. Unharmed, unscarred.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top