Re: Session-problem? Simple counter won't work

From: Date: Tue, 09 Aug 2005 15:43:36 +0000
Subject: Re: Session-problem? Simple counter won't work
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-220290@lists.php.net to get a copy of this message
Sabine wrote:
Hello to all, I'm working on a server where even a simple counter-script won't work. session_start(); if (isset($HTTP_SESSION_VARS['counter'])) { $HTTP_SESSION_VARS['counter']++; } else { $HTTP_SESSION_VARS['counter']=1; } On every refresh the counter is set to 1.
I take it this is not inside a function? have you tried using var_dump() to output $HTTP_SESSION_VARS? you may be stuck with doing things the old session_register() way rather than using $HTTP_SESSION_VARS (or preferably $_SESSION - if you had a version of php at your disposal that had that.)
I dont' know, where to search for the reasons. The server is a normal service providers server. My customers site is using sessions and they are working on his site.
I would suggest that you go thru his code line by line to figure out how it works. also check out this page: http://php.net/manual/en/function.session-set-cookie-params.php given that you want your own session on a specific subpath you will have to do some more owkr than just start the session.
My script lays in a subdirectory of my costumers site, protected with a .htaccess.: The PHP-Version is 4.0.6.
which idiot is setting 4.0.6 as a requirement - its old, has lots of bugs that have been fixed in more recent versions and is full _known_ security issues (which have also been fixed) ... upgrade is the sane thing to do. if there is one other person on this list using 4.0.6 you'll be lucky. all this means that your going to have a hard time getting things done - bottom line this costs your customer more (you are passing on the cost right?)
The values for the session-parameters are, as far as I see, standard: session.save_handler: files session.save_path: /tmp Register-globals is set to on. Has anybody an idea where the problem lays? Is it possible that I don' have the right to write into the /tmp-directory?
possible but unlikely, given that the main site works. try writing a file to /tmp.
It would be very nice of you to give me some tips. I don't want to ask my customer silly questions.
your customer is requiring 4.0.6 - nothing you can ask could be sillier than that ;-) (other than maybe asking to downgrade to php3)
Thanks in advance Sabine


« previous php.general (#220290) next »