Setting session.name using ini_set

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
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Setting session.name using ini_set

Post by anjanesh »

All this time I was using the default PHPSESSID.
Still unclear with sessions.

Code: Select all

localhost
 |
 |
 ---webiste1
 |
 |
 ---webiste2
In localhost/website1 I've set - ini_set("session.name" , "website1");
In localhost/website2 I've set - ini_set("session.name" , "website2");

When both are opened (in different tabs/windows)
session_name() should return website1 for website1 and website2 for website2 right ? Theres a session_name for each website - or setting it using ini_set sets it for entire localhost ?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Why not test it, instead of asking?
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

ini_set only changes ini settings for the remainder of the request that it is called in.
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

feyd wrote:Why not test it, instead of asking?
Because Im getting wierd results.
Im setting session.name to website1 in website1 and website2 in website2, but when both are opened, session.name is set to the last set value - irrespective of the folder (website1 or website2)
Actually I had installed PHP 5.1.1 - and deleted PHP 5.0.3 - so I overwrote all the settings....I guess something went wrong in that part.
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

Post Reply