PHP session problem on IIS server

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
SuperFly
Forum Newbie
Posts: 19
Joined: Thu Nov 10, 2005 9:47 am
Contact:

PHP session problem on IIS server

Post 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
Last edited by SuperFly on Wed Feb 27, 2008 12:07 pm, edited 1 time in total.
User avatar
Zoxive
Forum Regular
Posts: 974
Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan

Re: PHP session problem

Post 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.
SuperFly
Forum Newbie
Posts: 19
Joined: Thu Nov 10, 2005 9:47 am
Contact:

Re: PHP session problem

Post 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();
User avatar
Zoxive
Forum Regular
Posts: 974
Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan

Re: PHP session problem

Post by Zoxive »

What is your session.cookie_domain?

Does the URL happen to change subdomains? Gain/Lose www. or something else?
SuperFly
Forum Newbie
Posts: 19
Joined: Thu Nov 10, 2005 9:47 am
Contact:

Re: PHP session problem

Post by SuperFly »

It looks like I didn't connect everything right here. Looking for Bug and thanks for reply
SuperFly
Forum Newbie
Posts: 19
Joined: Thu Nov 10, 2005 9:47 am
Contact:

Re: PHP session problem

Post 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?
User avatar
Jade
Forum Regular
Posts: 908
Joined: Sun Dec 29, 2002 5:40 pm
Location: VA

Re: PHP session problem on IIS server

Post by Jade »

Sounds like maybe the session is timing out prematurely. You should probably check the session info in your config files.
SuperFly
Forum Newbie
Posts: 19
Joined: Thu Nov 10, 2005 9:47 am
Contact:

Re: PHP session problem on IIS server

Post 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
Post Reply