Problem with session /www vs http

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
rainerpl
Forum Newbie
Posts: 16
Joined: Mon Jun 20, 2011 12:46 pm

Problem with session /www vs http

Post by rainerpl »

Hi

Recently i ran into tedious problem when i started working on a php website.
It uses sessions to carry user data between pages as usual, but for some reason, it creates new session for domain with/without www.
e.g http://mysite.com has different session compared to http://www.mysite.com. So whenever user clicks on absolute url´s defined with full site url, they get one session, and relative links are using another session.

Does anybody know how to make the site use one session only?

ps: i have few calls for regenerating session id, if that may be a problem.


thanks in advance
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Problem with session /www vs http

Post by AbraCadaver »

Check: session_set_cookie_params(). Pay attention to the domain parameter.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Post Reply