PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > php.general > $_SESSION problem
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
$_SESSION problem

Réponse
 
LinkBack Outils de la discussion
Vieux 10/04/2008, 23h29   #1
tedd
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut $_SESSION problem

Hi gang:

I'm stumped and in need of some expert explanation.

I have prepared two demos (showing code) for your enjoyment:

[1] http://www.webbytedd.com/x/index.php
[2] http://sperling.com/x/index.php

Both of these demos have the exact same code; and are on the same
server; with exactly the same php-info -- so, why do they behave
differently re sessions?

Note that [1] will retain the session values throughout the entire
session, while [2] does not and loses session values.

Why?

Cheers,

tedd


--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
  Réponse avec citation
Vieux 11/04/2008, 03h12   #2
Eric Wood
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] $_SESSION problem

tedd wrote:
>
> [1] http://www.webbytedd.com/x/index.php
> [2] http://sperling.com/x/index.php
>
> Both of these demos have the exact same code; and are on the same
> server; with exactly the same php-info -- so, why do they behave
> differently re sessions?


Strange. I've run into issues whenever I use variable names which are
the same as session variables. It's as if they step on each others
toes. I try to use uniq var names. I've also recently run into
customized 401 pages (which you may not see happen, check the logs)
start up and the session data gets overwrite due to a lack of session
file locking.

-eric
  Réponse avec citation
Vieux 11/04/2008, 04h16   #3
paragasu
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] $_SESSION problem

it looks fine to me. but i want to share one bad experience with sessions.
the code i wrote work just fine on my testing server (please note, the
phpinfo is same with
my production server).

after days of figuring out why the session do not work. finally, i found the
solutions.
the solutions is to add a

@session_write_close() on the end of the execution code. on my case it
happen
every time i forward the page. so adding the @session_write_close before the
header('location: xxxx') fix the problem.

this might be a possible explanation..

  Réponse avec citation
Vieux 11/04/2008, 04h26   #4
mike
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] $_SESSION problem

I believe you can accomplish the same thing by just putting this in:

register_shutdown_function('session_write_close');



On 4/10/08, paragasu <paragasu@gmail.com> wrote:
> it looks fine to me. but i want to share one bad experience with sessions.
> the code i wrote work just fine on my testing server (please note, the
> phpinfo is same with
> my production server).
>
> after days of figuring out why the session do not work. finally, i found the
> solutions.
> the solutions is to add a
>
> @session_write_close() on the end of the execution code. on my case it
> happen
> every time i forward the page. so adding the @session_write_close before the
> header('location: xxxx') fix the problem.
>
> this might be a possible explanation..
>

  Réponse avec citation
Vieux 11/04/2008, 14h44   #5
tedd
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] $_SESSION problem [SOLVED (sort-of)]

At 10:12 PM -0400 4/10/08, Eric Wood wrote:
>tedd wrote:
>>
>>[1] http://www.webbytedd.com/x/index.php
>>[2] http://sperling.com/x/index.php
>>
>>Both of these demos have the exact same code; and are on the same
>>server; with exactly the same php-info -- so, why do they behave
>>differently re sessions?

>
>Strange. I've run into issues whenever I use variable names which
>are the same as session variables. It's as if they step on each
>others toes. I try to use uniq var names. I've also recently run
>into customized 401 pages (which you may not see happen, check the
>logs) start up and the session data gets overwrite due to a lack of
>session file locking.
>-eric



-eric:

You didn't provide the reason why, but you did provide a solution.

Changing the variable names to be different than the session names
fixed the problem.

Now, if any php guru would care to tell me why, I would really like to know.

Thanks eric.

Cheers,

tedd


--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
  Réponse avec citation
Vieux 11/04/2008, 17h25   #6
Nathan Nobbe
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] $_SESSION problem [SOLVED (sort-of)]

top posting for the hell of it;
disregard last post; i didnt see the [solved] sort-of thread.

-nathan

On Fri, Apr 11, 2008 at 7:44 AM, tedd <tedd.sperling@gmail.com> wrote:

> At 10:12 PM -0400 4/10/08, Eric Wood wrote:
>
> > tedd wrote:
> >
> > >
> > > [1] http://www.webbytedd.com/x/index.php
> > > [2] http://sperling.com/x/index.php
> > >
> > > Both of these demos have the exact same code; and are on the same
> > > server; with exactly the same php-info -- so, why do they behave differently
> > > re sessions?
> > >

> >
> > Strange. I've run into issues whenever I use variable names which are
> > the same as session variables. It's as if they step on each others toes. I
> > try to use uniq var names. I've also recently run into customized 401 pages
> > (which you may not see happen, check the logs) start up and the session data
> > gets overwrite due to a lack of session file locking.
> > -eric
> >

>
>
> -eric:
>
> You didn't provide the reason why, but you did provide a solution.
>
> Changing the variable names to be different than the session names fixed
> the problem.
>
> Now, if any php guru would care to tell me why, I would really like to
> know.
>
> Thanks eric.
>
> Cheers,
>
> tedd
>
>
> --
> -------
> http://sperling.com http://ancientstones.com http://earthstones.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 23h31.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,15457 seconds with 14 queries