errors in session/cookie php source?

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
dgr72371
Forum Newbie
Posts: 8
Joined: Mon Jun 14, 2004 9:18 am

errors in session/cookie php source?

Post by dgr72371 »

hello,
I'm just learning how to work with sessions and cookies in PHP code and have run into some errors in my test code (can be viewed at
http://sardgr.dyndns.org/movie1.php and http://sardgr.dyndns.org/moviesite.php)

When I load movie1.php I get:
Warning: open(/tmp\sess_14cf1d5ee795fc7d155ca73281083d7d, O_RDWR) failed: No such file or directory (2) in C:\FoxServ\www\movie1.php on line 2
Click here to see information about my favorite movie!
Warning: open(/tmp\sess_14cf1d5ee795fc7d155ca73281083d7d, O_RDWR) failed: No such file or directory (2) in Unknown on line 0

Warning: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0

When I load moviesite.php I get:


Warning: open(/tmp\sess_14cf1d5ee795fc7d155ca73281083d7d, O_RDWR) failed: No such file or directory (2) in C:\FoxServ\www\moviesite.php on line 2
Sorry, but you don't have permission to view this page!
Warning: open(/tmp\sess_14cf1d5ee795fc7d155ca73281083d7d, O_RDWR) failed: No such file or directory (2) in Unknown on line 0

Warning: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line


source code for movie1.php
--------
<?php
session_start();
$_SESSION['username']="Joe12345";
$_SESSION['authuser']=1;
?>
<HTML>
<HEAD>
<TITLE>Find my Favorite Movie!</TITLE>
</HEAD>
<BODY>
<?php
$myfavmovie=urlencode("Life of Brian");
echo "<a href='http://sardgr.dyndns.org/moviesite.php? ... myfavmovie'>";
echo "Click here to see information about my favorite movie!";
echo "</a>";
?>
</BODY>
</HTML>


source code for moviesite.php
---------
<?php
session_start();
//check to see if user has logged in with a valid password
if ($_SESSION['authuser']!=1) {
echo "Sorry, but you don't have permission to view this page!";
exit();
}
?>
<HTML>
<HEAD>
<TITLE>My Movie Site - <?php echo $_REQUEST['favmovie'] ?></TITLE>
</HEAD>
<BODY>
<?php
echo "My favorite movie is ";
echo $_REQUEST['favmovie'];
echo "<br>";
$movierate=5;
echo "My movie rating for this movie is: ";
echo $movierate;
?>
</BODY>
</HTML>



thanks for any assistance!
User avatar
Buddha443556
Forum Regular
Posts: 873
Joined: Fri Mar 19, 2004 1:51 pm

Post by Buddha443556 »

You have two different slashes in the path returned in the error. As the error says, "No such file or directory." Looks like Windows. I would start by checking session.save_path in php.ini.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Buddha's on the right track, you'll need to set your session.save_path to a valid folder. eg. C:/TMP/ or similar...
Post Reply