Re: php5-sessions next

From: Date: Thu, 03 Mar 2005 12:09:33 +0000
Subject: Re: php5-sessions next
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-38749@lists.php.net to get a copy of this message
mel list_php wrote:
Dear Martin, Thank you very much for that, I made the suggested changes. The problem was again coming from the session.save_path directive which was not well configured. With your settings I know have a wonderful display of "undefined index", coming from all that non instantiated variables...at least I know what I have to do now!!
you have 3 options with these kinds of errors: 1. change error_reporting to not include NOTICEs 2. change all the relevant code so that all vars are initialized (possibly lots of work) 3. use the '@' sign on the vars to repress the errors e.g: if (@$_GET['rule']) { // take over world } I wouldn't recommend 3 unless its a specific case and you know what you're doing
One thing: I use @session_start() because in the other case I have a warning a session has already been started. On the other had have to call it at the beginning of each script. Is there a way to test that?
you may be able to get away with testing to see whether session_id() returns an empty string or not (i.e. if its empty you still have to start the session) although I would recommend rewriting your session starting code so that you only call session_start() in one place - if you put all this code in a seperate file you can then require_once() the file as and when you need it.
With php5 I also saw than a script having a white line and only later on the <?php is not interpreted but displayed as text. Any reason for that?
that doesn't sound like it should be happening - post some code please.
Once again thank you for your help, and sorry I should have displayed the errors at the beginning.
now you know :-) - the next time someone hits the list with a similar case you can 'parrot' Martin's tips!


« previous php.db (#38749) next »