Trouble with session management with PHP 4
Posted: Mon Mar 15, 2004 12:38 pm
I am new to PHP and am trying to get a handle on session management. I seem to be having a problem with how PHP is configured on my Dev machine. I am using it with Apache 2.0 and have it installed as a module. I am doing all of this on Linux which I am also new to.
The problem I have is when I try to use the following code:
The page does not update as it should. When I uploaded the same code to the production server at my ISP the code works fine.
I comapred the results from phpinfo() from my ISP and my Dev machine and was unable to tell what if anything I may have doen wrong when I installed PHP.
Here are the results from my dev box:
Session Support enabled
Registered save handlers files user
Directive Local Value Master Value
session.auto_start Off Off
session.bug_compat_42 Off Off
session.bug_compat_warn On On
session.cache_expire 180 180
session.cache_limiter nocache nocache
session.cookie_domain no value no value
session.cookie_lifetime 0 0
session.cookie_path / /
session.cookie_secure Off Off
session.entropy_file no value no value
session.entropy_length 0 0
session.gc_divisor 1000 1000
session.gc_maxlifetime 1440 1440
session.gc_probability 1 1
session.name PHPSESSID PHPSESSID
session.referer_check no value no value
session.save_handler files files
session.save_path /tmp /tmp
session.serialize_handler php php
session.use_cookies On On
session.use_only_cookies Off Off
session.use_trans_sid On On
When I compare this infromationwith that of my ISP the only diffrences I can find appear to be related to the fact that my ISP is using 4.2.2 and I am using 4.3.4, as well as the fact that I compiled PHP with debugging support.. Unfortunetly I am not experinced enough with PHP to be able to tell for sure.
Here is the info from my ISP:
Session Support enabled
Directive Local Value Master Value
session.auto_start Off Off
session.cache_expire 180 180
session.cache_limiter nocache nocache
session.cookie_domain no value no value
session.cookie_lifetime 0 0
session.cookie_path / /
session.cookie_secure Off Off
session.entropy_file no value no value
session.entropy_length 0 0
session.gc_maxlifetime 1440 1440
session.gc_probability 1 1
session.name PHPSESSID PHPSESSID
session.referer_check no value no value
session.save_handler files files
session.save_path /tmp /tmp
session.serialize_handler php php
session.use_cookies On On
session.use_trans_sid 1 1
Any help or suggestions would be greatly appreciated.
The problem I have is when I try to use the following code:
Code: Select all
<?php
session_start();
session_register("SESSION");
if (! isset($SESSION)) {
$SESSION["count"] = 0;
echo "<li>Counter initialized, please reload this page to see it increment";
} else {
echo "<li>Waking up session $PHPSESSID";
$SESSION["count"]++;
}
echo "<li>The counter is now $SESSION[count] ";
?>I comapred the results from phpinfo() from my ISP and my Dev machine and was unable to tell what if anything I may have doen wrong when I installed PHP.
Here are the results from my dev box:
Session Support enabled
Registered save handlers files user
Directive Local Value Master Value
session.auto_start Off Off
session.bug_compat_42 Off Off
session.bug_compat_warn On On
session.cache_expire 180 180
session.cache_limiter nocache nocache
session.cookie_domain no value no value
session.cookie_lifetime 0 0
session.cookie_path / /
session.cookie_secure Off Off
session.entropy_file no value no value
session.entropy_length 0 0
session.gc_divisor 1000 1000
session.gc_maxlifetime 1440 1440
session.gc_probability 1 1
session.name PHPSESSID PHPSESSID
session.referer_check no value no value
session.save_handler files files
session.save_path /tmp /tmp
session.serialize_handler php php
session.use_cookies On On
session.use_only_cookies Off Off
session.use_trans_sid On On
When I compare this infromationwith that of my ISP the only diffrences I can find appear to be related to the fact that my ISP is using 4.2.2 and I am using 4.3.4, as well as the fact that I compiled PHP with debugging support.. Unfortunetly I am not experinced enough with PHP to be able to tell for sure.
Here is the info from my ISP:
Session Support enabled
Directive Local Value Master Value
session.auto_start Off Off
session.cache_expire 180 180
session.cache_limiter nocache nocache
session.cookie_domain no value no value
session.cookie_lifetime 0 0
session.cookie_path / /
session.cookie_secure Off Off
session.entropy_file no value no value
session.entropy_length 0 0
session.gc_maxlifetime 1440 1440
session.gc_probability 1 1
session.name PHPSESSID PHPSESSID
session.referer_check no value no value
session.save_handler files files
session.save_path /tmp /tmp
session.serialize_handler php php
session.use_cookies On On
session.use_trans_sid 1 1
Any help or suggestions would be greatly appreciated.