note 24074 deleted from function.session-register by sniper
| From: | sniper@php.net | Date: | Thu, 31 Oct 2002 00:48:17 +0000 |
| Subject: | note 24074 deleted from function.session-register by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-38788@lists.php.net to get a copy of this message | ||
I had trouble getting sessions working. The symptom was that the session variables could be set
once, but they never changed. For example, in the following code, "counter" would always
display as 1.
<?php session_start();
// register a session variable
session_register('counter');
// increment and display the value of the counter
$counter++;
echo("You have visited this page $counter times! Don't you have
anything else to do, you bum?!");
?>
I could see the session file created, and I could see it being updated... but the value of counter
in the file never changed.
The problem turned out to be that the expected path of php.ini was NOT the path where php.ini was.
PHP never complained about this, and did everything else right... so the solution was not obvious.
To see if this is the case for you, run this code:
<?php
phpinfo();
?>
and check the field that lists the php.ini path.