★ wanayoo — archive 1999 http://www.devshed.com/Talk/Forums/Forum5/HTML/001101.htmlNouvelle recherche | Portail wanayoo
DevShed Menu
* DevShed Home
* Developer News
* DevShed Brain Dump




UBBFriend: Email This Page to Someone!
  DevShed Discussion Forums
  PHP
  Sessions\http

Post New Topic  Post A Reply
profile | register | preferences | faq | search

next newest topic | next oldest topic
Author Topic:   Sessions\http
devCisk
Member
posted May 12, 2000 11:41 AM     Click Here to See the Profile for devCisk   Click Here to Email devCisk     Edit/Delete Message Reply w/Quote
win98/apache1.3.9/php4 rc1

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

Does anyone know how i can fix this? I have the following in my php.ini

session.save_handler = files ; handler used to store/retrieve data
session.save_path = /tmp ; argument passed to save_handler
; in the case of files, this is the
; path where data files are stored
session.use_cookies = 1 ; whether to use cookies
session.name = PHPSESSID
; name of the session
; is used as cookie name

etc...

i tried changing session.save_path to a local directory but that doesn't seem to work?

-----
also... http_authentication doesn't work on my local machine. It keeps on giving me a 500 error and says it can't be displayed with the following code:

if(!isset($PHP_AUTH_USER)) {
Header("WWW-Authenticate: Basic realm=\"test\"");
Header("HTTP/1.0 401 Unauthorized");
echo "cancel this!\n";
exit;
} else {
echo "Hello $PHP_AUTH_USER.<P>";
echo "You entered $PHP_AUTH_PW as your password.<P>";
}

Is there something i need to turn on in my .conf files?

any help would be greately appreciated =)

Cisk

aarongb
Member
posted May 12, 2000 12:31 PM     Click Here to See the Profile for aarongb   Click Here to Email aarongb     Edit/Delete Message Reply w/Quote
Okay, first problem. I'm flying by the seat of my Lugz here. Your php.ini is probably fine (identical to my win32 install). Try the following code. I just got through this problem, and I found an error in my code with the way I was registering sessions (they weren't registering, same "session.save_path" message). As for the second question, it won't work on Win32. All the reasons can be found all over this board with a search.

<?php
//Sessiontest.php4
//From DevShed.
session_start();
// session variable to store the counter.
session_register('counter');
// session variable to store the value when the page was last loaded;
// this value is maintained so that difference can be calculated.
session_register('timeAtLastLoad');
// current time
$timeNow = time();
// increment counter
$counter++;
// calculate the time lapsed from last visit.
$timeLapsed = $timeNow - $timeAtLastLoad;
// display appropriate message
if($counter > 1)
{
echo "<b>It's been $timeLapsed seconds since you last viewed this page.</b>";
}
else
{
echo "<b>First time here? Reload this page to see how the session works!</b>";

}
$timeAtLastLoad = $timeNow;
?>

devCisk
Member
posted May 12, 2000 02:48 PM     Click Here to See the Profile for devCisk   Click Here to Email devCisk     Edit/Delete Message Reply w/Quote
Thanks for the help but i keep getting this:

First time here? Reload this page to see how the session works!
Warning: Failed to write session data. Please check that the current setting of session.save_path is correct (/tmp) in Unknown on line 0

I'm not sure what i'm doing wrong so i'll include the code thats in the file exactly.

<?

//Sessiontest.php4
//From DevShed.
session_start();
// session variable to store the counter.
session_register('counter');
// session variable to store the value when the page was last loaded;
// this value is maintained so that difference can be calculated.
session_register('timeAtLastLoad');
// current time
$timeNow = time();
// increment counter
$counter++;
// calculate the time lapsed from last visit.
$timeLapsed = $timeNow - $timeAtLastLoad;
// display appropriate message
if($counter > 1)
{
echo "<b>It's been $timeLapsed seconds since you last viewed this page.</b>";
}
else
{
echo "<b>First time here? Reload this page to see how the session works!</b>";

}
$timeAtLastLoad = $timeNow;


?>

that's all i have.. it should work no?

Cisk

devCisk
Member
posted May 13, 2000 03:03 PM     Click Here to See the Profile for devCisk   Click Here to Email devCisk     Edit/Delete Message Reply w/Quote
I upgraded to PHPrc2 and now it works? hehe. I don't understand why but it works good now.

Thanks anywayl

Cisk

All times are MST (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic
Post New Topic  Post A Reply
Hop to:

Contact Us | DevShed.com

Copyright © 1997-2000 ngenuity. All rights reserved.

Powered by: Ultimate Bulletin Board, Version 5.41a
© Infopop Corporation (formerly Madrona Park, Inc.), 1998 - 1999.