By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 916 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

Keeping the same session_id when a page is refreshed

P: n/a
I have the following script:

<?PHP
session_start();
echo session_id();
?>

But it gives a different session_ID() everytime the page is reloaded.
Is there any way to keep the same session_ID() until the browser window
is closed?

Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
There are two methods to propagate a session id: cookies & URL
parameter.

I suppose you are using the first one. The most probable cause is the
fact that you do not have cookies enabled in your browser.

Another thing might be the fact that you have not set up the
session.save_path variable in php.ini...

Clau

Jul 17 '05 #2

P: n/a
I have cookies enabled and I have session.save_path setup in php.ini
and it still doesn't work in either Firefox or Internet Explorer.

Jul 17 '05 #3

P: n/a
I`m blank then. The only times I had this problem was when
session.save_path was pointing to a bogus directory _OR_ the disk was
full/did not have write acces there. On Windows you should use single
backslashes (i.e. w:\php\sessions) with no trailing slash.

Clau

Jul 17 '05 #4

P: n/a

<ja****@gmail.com> wrote in message
news:11********************@c13g2000cwb.googlegrou ps.com...
I have cookies enabled and I have session.save_path setup in php.ini
and it still doesn't work in either Firefox or Internet Explorer.


Make sure the folder in fact exists. PHP won't create it itself. And use
forward slashes in the path even when it's on Windows. That's the preferred
practice for both PHP and Apache.

Do a print_r($_COOKIE) at the end of the page to see if you're actually
receiving the cookie.
Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.