08-24-2007, 04:21 PM
Hope you can advice on this.
Can anyone tell me why a session is being appended to a URL
In my code I have some hard code links like,
But in the browser it is showing it like.
Is there a settings in the php.ini doing this.
I hope you can advise.
Thanks in advance
08-24-2007, 04:22 PM
PHP will append the session ID to a URL automatically if the client has cookies disabled.
08-24-2007, 04:26 PM
But I have cookies enabled and it is still doing it.
Plus it seems to be random ?
08-24-2007, 04:28 PM
If it's random then it's not a PHP setting. Look at your script code and do some tests..
08-24-2007, 04:59 PM
If session.use_cookies is zero or off (either it is specifically set to this value or perhaps php cannot find or load the php.ini file) then php will attempt to pass the session ID as a parameter on the url.
Also, even with session.use_cookies set to one or on and if session.use_trans_sid is set to one or on, php will automatically append the session ID to the url if it cannot set the cookie. If this is occurring, php also only appends the session ID to relative url's. If you use an absolute url - http://somedomain.com... then php does not append the session ID. One or both of these is what I believe is causing the apparent "random" nature of this happening.
Just because you have cookies enabled in your browser, does not mean that your script is able to send them. Check your web server log for errors and/or turn on full php error reporting. Look for something like "headers could not be sent..."