Forum Moderators: coopster

Message Too Old, No Replies

session destroy warning!

         

smagdy

6:01 pm on Dec 14, 2004 (gmt 0)

10+ Year Member



HI,
ive "logout" that turns to be a link when a variable $name is registerd and that goes fine.

then ive logout.php file having this code:

<?php

session_start();

$_SESSION = array();

if (isset($_COOKIE[session_name()])) {
setcookie(session_name(), '', time()-42000, '/');
}

session_destroy();
?>

and when I click on the "logout" link I get this error so why?

Warning: Session object destruction failed in C:\Documents and Settings\Administrator\My Documents\php\Budget\bu\logout.php on line 16

thanks in advance

jatar_k

5:15 pm on Dec 15, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I only use

$_SESSION = array();
session_destroy();

i don't worry about removing the cookie. My login check script won't let them do anything since there is actually no data in the session. I never check the cookie itself for anything.

smagdy

7:42 pm on Dec 15, 2004 (gmt 0)

10+ Year Member



i still get same error

jatar_k

8:37 pm on Dec 15, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



what version of php are you running?

and what happens if you only do

session_destroy();

?

smagdy

8:55 pm on Dec 15, 2004 (gmt 0)

10+ Year Member



PHP Version 4.0.3pl1

Warning: Session object destruction failed in C:\.....

I used
session_unregister("name");

but I dono if I can just depend on that and not destroy it after loging out.

jatar_k

9:16 pm on Dec 15, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



>> 4.0.3pl1

all of the bug reports and errors mentioned that version. Update the version and it will go away from all of the threads/bugs I found.

smagdy

9:33 pm on Dec 15, 2004 (gmt 0)

10+ Year Member



Hmm can u give me a hint on how to upgrade cuz it confuse me sometimes..

I mean i know there is PHP 5 so should I go with it. and should I just install what I will download and all goes fine or ive to edit php.ini or something?

thanks

jatar_k

9:47 pm on Dec 15, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



you could go with, either, 4.3.10 or 5.0.3

I actually installed this 2 weeks ago and I used these 2 tutorials

Installing a new web server: Apache2, PHP5, MySQL4 and PHPmyAdmin [webmasterworld.com]
Installing PHP5 Under Windows XP and Apache [webmasterworld.com]

My personla preference was the second one, but that's just me. In your case it will be a bit different, since you just need to upgrade php. I would literally remove all core php files (find out where it is stored) and then search your disk for any stray php.ini files since that will screw everything up.

I actually followed the first tutorial above and it didn't work, so I had to remove/undo the php install. Then I followed the second tutorial and it was flawless.

<aside>no offense henry0 ;)

smagdy

10:03 pm on Dec 15, 2004 (gmt 0)

10+ Year Member



I have IIS

jatar_k

10:05 pm on Dec 15, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



sorry, I have no idea how to install on IIS but

Installing PHP on Windows IIS [php.net]

or the general section on windows installation
PHP Installation on Windows systems [php.net]