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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
crazytopu
Forum Contributor
Posts: 259
Joined: Fri Nov 07, 2003 12:43 pm
Location: London, UK
Contact:

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

Post 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..
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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..
crazytopu
Forum Contributor
Posts: 259
Joined: Fri Nov 07, 2003 12:43 pm
Location: London, UK
Contact:

Post by crazytopu »

thanks! it works!
Post Reply