Wrox Programmer Forums
|
BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6
This is the forum to discuss the Wrox book Beginning PHP, Apache, MySQLWeb Development by Michael K. Glass, Yann Le Scouarnec, Elizabeth Naramore, Gary Mailer, Jeremy Stolz, Jason Gerner; ISBN: 9780764557446
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 17th, 2004, 08:20 AM
Registered User
 
Join Date: Jun 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default errors in session/cookie php source?

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?favmovie=$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!

 
Old June 17th, 2004, 08:49 AM
Authorized User
 
Join Date: Jun 2004
Posts: 37
Thanks: 0
Thanked 0 Times in 0 Posts
Default

What does your php.ini look like. Sounds like a server/php installation error.

 
Old June 17th, 2004, 02:25 PM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

This has become a common problem here lately.

A few things:
Open php.ini (C:\Windows\php.ini, or where ever Windows is installed) and set the session.save_path directive to reflect where PHP sessions should be saved. I recommend C:\PHP\sessiondata or where ever PHP is installed.

Next verify that C:\PHP\sessiondata exists, if the directory doesn't exist, create it.

The default value of session.save_path is /tmp, which is for Unix file systems, so Windows users have to specify the session save path explicitly.

Next you must give PHP permission to write to and read from that directory.. if using Windows XP I wrote this tutorial:
http://p2p.wrox.com/topic.asp?TOPIC_ID=11962

Be sure to restart Apache if PHP is installed as an Apache module. Now the script should work.

HTH!


Regards,
Rich

::::::::::::::::::::::::::::::::::::::::::
The Spicy Peanut Project
http://www.spicypeanut.net
::::::::::::::::::::::::::::::::::::::::::
 
Old September 28th, 2007, 03:32 AM
Registered User
 
Join Date: Sep 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks! I was having the same problems, and this soln helped me get php and phpmyadmin working on WinXP/IIS5.1

;)

Quote:
quote:Originally posted by richard.york
 This has become a common problem here lately.

A few things:
Open php.ini (C:\Windows\php.ini, or where ever Windows is installed) and set the session.save_path directive to reflect where PHP sessions should be saved. I recommend C:\PHP\sessiondata or where ever PHP is installed.

Next verify that C:\PHP\sessiondata exists, if the directory doesn't exist, create it.

The default value of session.save_path is /tmp, which is for Unix file systems, so Windows users have to specify the session save path explicitly.

Next you must give PHP permission to write to and read from that directory.. if using Windows XP I wrote this tutorial:
http://p2p.wrox.com/topic.asp?TOPIC_ID=11962

Be sure to restart Apache if PHP is installed as an Apache module. Now the script should work.

HTH!


Regards,
Rich

::::::::::::::::::::::::::::::::::::::::::
The Spicy Peanut Project
http://www.spicypeanut.net
::::::::::::::::::::::::::::::::::::::::::






Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP session cookie ajit Beginning PHP 0 October 23rd, 2007 11:56 PM
Encrypting session cookie krisXp Classic ASP Databases 1 November 9th, 2006 10:21 AM
Cookie and Session rinventive PHP How-To 0 December 6th, 2005 07:09 PM
session and cookie problem (empty session file) msincan BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 February 27th, 2005 05:31 PM
Session and Cookie authentification dsunmedia PHP How-To 2 August 30th, 2004 06:52 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.