Page 1 of 1

session_start() - Why am I getting this nasty error msg?

Posted: Sun Jul 11, 2004 12:17 pm
by crazytopu
hi guys,

I am new to PHP session. I tired this HTML form :

Code: Select all

<FORM METHOD="POST" ACTION="page2.php"> 
Enter your Name: <input type="text" name="name"> 
<input type="SUBMIT" value="Submit"> 
</FORM>
and this PHP script:

Code: Select all

<?php
<?php 
// start the session 
session_start(); 
header("Cache-control: private"); //IE 6 Fix 

echo "<strong>Step 2 - Register Session </strong><br />"; 

// Get the user's input from the form 
   $name = $_POST['name']; 

// Register session key with the value 
   $_SESSION['name'] = $name; 

// Display the sssion information: 
?> 

Welcome to my website <strong><? echo $_SESSION['name']; ?></strong>!<br /> 
Let's see what happens on the <a href="page3.php">next page.</a><br /><br /> 

?>
and see what error msg i rcved?!! -

Code: Select all

Warning: session_start(): open(/tmp\sess_f5f742223c39d689a5800a94129e8787, O_RDWR) failed: No such file or directory (2) in c:\program files\apache group\apache\htdocs\page2.php on line 3

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at c:\program files\apache group\apache\htdocs\page2.php:3) in c:\program files\apache group\apache\htdocs\page2.php on line 3

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at c:\program files\apache group\apache\htdocs\page2.php:3) in c:\program files\apache group\apache\htdocs\page2.php on line 3

Warning: Cannot modify header information - headers already sent by (output started at c:\program files\apache group\apache\htdocs\page2.php:3) in c:\program files\apache group\apache\htdocs\page2.php on line 4
Step 2 - Register Session 
Welcome to my website crazy !
Let's see what happens on the next page.


Warning: Unknown(): open(/tmp\sess_f5f742223c39d689a5800a94129e8787, 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

Can anybody pin point the problem? it seems that the script is correct. To work with session do I have to make any changes in the configuration file or something similar?

Many thanks in advance..

Posted: Sun Jul 11, 2004 12:21 pm
by feyd
your session.save_path (or whatever it is) isn't set up for windows machines. Find the session section of your php.ini and change the save_path to a valid director c:/temp/ or something..

Posted: Sun Jul 11, 2004 12:32 pm
by crazytopu
thanks! it works!