Page 1 of 1
PHP session problem on IIS server
Posted: Wed Feb 27, 2008 10:26 am
by SuperFly
Hi Everyone,
I have something strange here. I have one login page let's say :
/index.php, when user fill out webform and hit submit I check for his details and put info in session, after that I redirect user to agent/index.php and when I check for session there it doesen't exist. In other words when I send logged user to some folder and check for session, session is empty, but when I check it again on login page, session is set. What could be the problem, maybe something in php.ini?
Thanks in advance
Regards
Re: PHP session problem
Posted: Wed Feb 27, 2008 10:28 am
by Zoxive
Is session_start() called before anything is output to the browser in agent/index.php?
The session needs to be initiated on every page that you want to use sessions.
Re: PHP session problem
Posted: Wed Feb 27, 2008 10:35 am
by SuperFly
Yes it is, I have one file common.inc.php which I include on every page and in that file is session_start();
Re: PHP session problem
Posted: Wed Feb 27, 2008 11:06 am
by Zoxive
What is your session.cookie_domain?
Does the URL happen to change subdomains? Gain/Lose www. or something else?
Re: PHP session problem
Posted: Wed Feb 27, 2008 11:14 am
by SuperFly
It looks like I didn't connect everything right here. Looking for Bug and thanks for reply
Re: PHP session problem
Posted: Wed Feb 27, 2008 12:06 pm
by SuperFly
ok, I didn't mention that this code is on IIS server, when I test same code on Apache it works without problems, like it should, but on IIS sessions doesen't work, is there something in IIS configuration which could cause this?
Re: PHP session problem on IIS server
Posted: Wed Feb 27, 2008 2:23 pm
by Jade
Sounds like maybe the session is timing out prematurely. You should probably check the session info in your config files.
Re: PHP session problem on IIS server
Posted: Thu Feb 28, 2008 1:21 am
by SuperFly
There is nothing strange, but please if you see something strange please refer.
Here is my session settings got from phpinfo:
Session Support enabled
Registered save handlers files user
Registered serializer handlers php php_binary wddx
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_httponly Off Off
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.hash_bits_per_character 5 5
session.hash_function 0 0
session.name PHPSESSID PHPSESSID
session.referer_check no value no value
session.save_handler files files
session.save_path C:\DOCUME~1\zlatko\LOCALS~1\Temp\php\session C:\DOCUME~1\zlatko\LOCALS~1\Temp\php\session
session.serialize_handler php php
session.use_cookies On On
session.use_only_cookies Off Off
session.use_trans_sid 0 0
Thanks