Page 1 of 1

Session and Cookies

Posted: Wed Aug 01, 2007 2:32 am
by waqas_punjabian
Hi all,

please tell me one thing about session:

I've found if a user will disable Cookies in his Browser (FireFox,IE7) then it directly affects session, means I cannot create a session if user disable the cookie. Someone told me to turn off this option in php.ini

session.use_cookies = 1 (turn it to '0')

It worked fine, but the thing is, we have some other sites on this server as well. So is there a way to turn this option off using some php code or function?

or is there a way to separate the session functionality from cookie involvement.

furthermore, I use session in this way:

Code: Select all

$_SESSION['user_id'] = "123";
regards,

Waqas

Posted: Wed Aug 01, 2007 2:45 am
by Christopher
I believe it is the setting "session.use_only_cookies" that you might want to look at. If it is set to "1" then sessions only work with cookies enabled.

Posted: Wed Aug 01, 2007 2:50 am
by waqas_punjabian
thanks for your reply,

yes it may be "session.use_only_cookies". But my problem is still their: can I do this setting using my php code ?

or is there any other way to create the session? (that will not be interfered by cookie disabling)

check this one

Posted: Wed Aug 01, 2007 3:46 am
by tansoft
You can set it in .htaccess

php_flag session.use_only_cookies off

or you this in your php code.

ini_set('session.use_only_cookies', false);