Closed Thread Icon

Preserved Topic: phpsessions on win and *nix (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=21216" title="Pages that link to Preserved Topic: phpsessions on win and *nix (Page 1 of 1)" rel="nofollow" >Preserved Topic: phpsessions on win and *nix <span class="small">(Page 1 of 1)</span>\

 
GRUMBLE
Paranoid (IV) Mad Scientist

From: Omicron Persei 8
Insane since: Oct 2000

posted posted 03-09-2002 18:06

is there a known fact that windows and linux handle phpsessions differently?
im developing on win where everything works fine, but on my host, which is on a redhat linux, the session is destroyed right on the next link after it has been created.
this is about the code i use:

(this comes after form submitting)
@session_start();
session_register("user");
$user='examplename';

then, when i click on another link on the page, on the next page, the session does not exist anymore.

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 03-09-2002 22:29

You should check how PHP is configured on your Linux server. Sessions should work fine on both Windows & Linux...


butcher
Paranoid (IV) Inmate

From: New Jersey, USA
Insane since: Oct 2000

posted posted 03-10-2002 01:17

Is it possible the sess id needs to be imbedded in the link?

-Butcher-

GRUMBLE
Paranoid (IV) Mad Scientist

From: Omicron Persei 8
Insane since: Oct 2000

posted posted 03-10-2002 15:03

max,
php 4.0.6 on my host
php 4.1.1 on my local machine

except for session.save_path the configuration is identically.

butcher,
hmmm. i dont think so. that would make no sense... but maybe... hmmm. strange.

Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 03-10-2002 17:34

well, my guess is that your session_path on the unix machine (where the sessions break) is set incorrectly.
maybe try to show *all* errors with
error_reporting(E_ALL);

but don't forget to disable it before going live :-)

so long,
TP

GRUMBLE
Paranoid (IV) Mad Scientist

From: Omicron Persei 8
Insane since: Oct 2000

posted posted 03-11-2002 16:56

butcher man you were right!
i have to forward the session id. than it works.

is there an easy way to add the sessionid to every link automatically? with hands its lots of work, when you got many scripts.

GRUMBLE
Paranoid (IV) Mad Scientist

From: Omicron Persei 8
Insane since: Oct 2000

posted posted 03-11-2002 17:20

ini_set('session.use_trans_sid', '1');
this is the critical line i think. but setting them in the script does not always work because, it has also to be compiled into the php engine itself.

max, i noticed that maxworld also uses sessions. how did you handle them? add &$SID to every link?

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 03-11-2002 18:45

Just to make things as easy as possible for developers I'd write a little linkto function where they just need to put in the URL

<? linkto('/wherever/page.php'); ?>

which can write out the whole link with SID for them. even the href whatever.




.:[ The Tao of Steve ]:.
Be Desireless
Be Excellent
Be Gone
...................................

GRUMBLE
Paranoid (IV) Mad Scientist

From: Omicron Persei 8
Insane since: Oct 2000

posted posted 03-11-2002 20:21

good idea, bitdamaged. thanks.

Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 03-11-2002 20:48

Dig in the docs a bit Grumble, I think I remember there was a way to have php auto append the SID to every link...

seems it has to be compiled with the support for it enabled
"
The <?=SID?> is not necessary, if --enable-trans-sid was used to compile PHP."
Php Manual on Sessions

Tyberius Prime

butcher
Paranoid (IV) Inmate

From: New Jersey, USA
Insane since: Oct 2000

posted posted 03-12-2002 03:17

Grumble

I think Bitdamaged has a good way to go...

A simple function that appends <?=SID?> to each link should work nicely.

-Butcher-

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 03-12-2002 07:21

Grumble, I'm adding SID parameter manually in a similar way like Bitdamaged. I have a few functions that manipulate with URLs. Also note that SID is only added if sessions are enabled, so that search engines can index my web site properly (sessions are enabled only when someone uses one of the common web browsers to view my site).


« BackwardsOnwards »

Show Forum Drop Down Menu