User Sessions Problem

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
NotOnUrNelly
Forum Commoner
Posts: 61
Joined: Wed Mar 24, 2004 4:45 pm

User Sessions Problem

Post by NotOnUrNelly »

Hi All

I am currently working through a basic on PHP, I have typed the following code to start a user session. Once the program has run in the browser I get an error on my page. (error below code)

<?php
session_start();
?>
<html>
<head>
<title>Listing 16.1 Starting or resuming a session</title>
</head>
<body>
<?php
print "<p>Your session ID is ".session_id()."</p>\n\n";
?>
</body>
</html>

************ERROr********************************

Warning: session_start(): open(/tmp\sess_3149f8c4a854134bd5c98b3a567e81fa, O_RDWR) failed: No such file or directory (2) in C:\Program Files\Apache Group\Apache2\htdocs\hour16\listing16.1.php on line 2

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at C:\Program Files\Apache Group\Apache2\htdocs\hour16\listing16.1.php:2) in C:\Program Files\Apache Group\Apache2\htdocs\hour16\listing16.1.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\hour16\listing16.1.php:2) in C:\Program Files\Apache Group\Apache2\htdocs\hour16\listing16.1.php on line 2

Your session ID is 3149f8c4a854134bd5c98b3a567e81fa


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


********************************************************
As you can see the code has run partly and given me a session ID

I just do not understand why the error is occuring

Can anyone help

Many Thanks
Jamie
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Edit c:\windows\php.ini and change session.save_path from /tmp to something like c:\temp (or some other temp dir that exists).
Then restart apache.
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

and make sure c:\temp exists..

I didnt have to edit the php config, only create a new folder in c:\ called "tmp" to get mine working..
Post Reply