473,587 Members | 2,526 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Session ID changed everytime go to new page or reload.

Hi, I'm new member of this group.

I had added new virtual host at my intranet server. The new virtual
host configuration on httpd.conf is similar with the old one.
At the new virtual host, the session id seems changed every
interaction to server (new page or reload).
The old one is fine, the session id keeps at the same string.
Both are at the same server.
I use Apache 2.2.3 (Win32) with PHP 5.2.0.

Tested using code below:
session_start() ;
echo session_id();
PHP Configuration :
session.save_ha ndler = files
;session.save_p ath = "/tmp"
session.use_coo kies = 1
;session.use_on ly_cookies = 1
session.name = PHPSESSID
session.auto_st art = 0
session.cookie_ lifetime = 0
session.cookie_ path = /
session.cookie_ domain =
session.seriali ze_handler = php
session.gc_prob ability = 1
session.gc_divi sor = 1000
session.gc_maxl ifetime = 1440
session.bug_com pat_42 = 0
session.bug_com pat_warn = 1
session.referer _check =
session.entropy _length = 0
session.entropy _file =
;session.entrop y_length = 16
;session.entrop y_file = /dev/urandom
session.cache_l imiter = nocache
session.cache_e xpire = 180
session.use_tra ns_sid = 0
session.hash_fu nction = 0
session.hash_bi ts_per_characte r = 5

How to fix the new host to keep its session id unchanged?
Sorry for the bad english.
TIA

Apr 9 '07 #1
11 13137
Bocah Sableng wrote:
Hi, I'm new member of this group.

I had added new virtual host at my intranet server. The new virtual
host configuration on httpd.conf is similar with the old one.
At the new virtual host, the session id seems changed every
interaction to server (new page or reload).
The old one is fine, the session id keeps at the same string.
Both are at the same server.
I use Apache 2.2.3 (Win32) with PHP 5.2.0.

Tested using code below:
session_start() ;
echo session_id();
PHP Configuration :
session.save_ha ndler = files
;session.save_p ath = "/tmp"
session.use_coo kies = 1
;session.use_on ly_cookies = 1
session.name = PHPSESSID
session.auto_st art = 0
session.cookie_ lifetime = 0
session.cookie_ path = /
session.cookie_ domain =
session.seriali ze_handler = php
session.gc_prob ability = 1
session.gc_divi sor = 1000
session.gc_maxl ifetime = 1440
session.bug_com pat_42 = 0
session.bug_com pat_warn = 1
session.referer _check =
session.entropy _length = 0
session.entropy _file =
;session.entrop y_length = 16
;session.entrop y_file = /dev/urandom
session.cache_l imiter = nocache
session.cache_e xpire = 180
session.use_tra ns_sid = 0
session.hash_fu nction = 0
session.hash_bi ts_per_characte r = 5

How to fix the new host to keep its session id unchanged?
Sorry for the bad english.
TIA
What's in your Apache error log (or where ever you have your PHP errors
being logged)?

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Apr 9 '07 #2
On Apr 9, 7:52 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
>
What's in your Apache error log (or where ever you have your PHP errors
being logged)?
Thanks for you response.

There's no line indicating any error on my Apache error log, and the
PHP errors are not logged.

The php code I posted before seems normally executed. Here is a snip
from my Apache access log (and repeated several times) :
192.168.1.90 - - [09/Apr/2007:11:54:17 +0700] "GET /session_id.php
HTTP/1.1" 200 330

I don't know the mechanisms of session id generation. 'Cos when I move
the new virtual host at the top and accessed using its local IP
address (192.168.1.90), the problem disappears. But when accessed
using named vhost (even if the new vhost config at the top), the
problem still remain.
Should I post the vhost config? (This group is php newsgroup)

And another info:
I use 'register_globa ls=on' and also 'register_long_ arrays=on' for
backward compatibility with my ancient scripts. I know it's a bad
habit, but I use the application and the server both for intranet app
only and I don't have much time to fix all.

Thanks.

Apr 9 '07 #3
On Apr 9, 7:54 pm, "Bocah Sableng" <cahsabl...@gma il.comwrote:

[...]
And another info:
I found Bug #16263 on http://bugs.php.net/bug.php?id=16263.
But I don't think it's the same problem.

Apr 9 '07 #4
>I had added new virtual host at my intranet server. The new virtual
>host configuration on httpd.conf is similar with the old one.
What is the domain name of the new host and the old one? If they
are in different domains, the browser won't send cookies (including
the session cookie) from one domain to another. Do you have
cross-links between virtual hosts? It looks like you are using
host-only cookies (session.cookie _domain unset), so cookies won't
be passed by the browser between hosts.
>At the new virtual host, the session id seems changed every
interaction to server (new page or reload).
The old one is fine, the session id keeps at the same string.
Both are at the same server.
I use Apache 2.2.3 (Win32) with PHP 5.2.0.

Tested using code below:
session_start( );
echo session_id();
PHP Configuration :
session.save_h andler = files
;session.save_ path = "/tmp"
session.use_co okies = 1
;session.use_o nly_cookies = 1
session.name = PHPSESSID
session.auto_s tart = 0
session.cookie _lifetime = 0
session.cookie _path = /
session.cookie _domain =
session.serial ize_handler = php
session.gc_pro bability = 1
session.gc_div isor = 1000
session.gc_max lifetime = 1440
session.bug_co mpat_42 = 0
session.bug_co mpat_warn = 1
session.refere r_check =
session.entrop y_length = 0
session.entrop y_file =
;session.entro py_length = 16
;session.entro py_file = /dev/urandom
session.cache_ limiter = nocache
session.cache_ expire = 180
session.use_tr ans_sid = 0
session.hash_f unction = 0
session.hash_b its_per_charact er = 5

How to fix the new host to keep its session id unchanged?
Sorry for the bad english.
TIA

Apr 9 '07 #5
On Apr 10, 5:51 am, gordonb.7i...@b urditt.org (Gordon Burditt) wrote:
>
What is the domain name of the new host and the old one?
My old domain is sinau.dev, and the new one is op_pusat.dev. (I
use .dev for development)
If they
are in different domains, the browser won't send cookies (including
the session cookie) from one domain to another.
Do you have cross-links between virtual hosts?
I don't understand the meaning of 'cross-link'
It looks like you are using
host-only cookies (session.cookie _domain unset), so cookies won't
be passed by the browser between hosts.
Reading your post, I found another clue. I try to check cookies.
Tested using FF 1.5, the problem disappear (session id remains
unchanged).
Using IE6, session id always changed, even if the domain is in trusted
sites list.

I try to get cookie info by executing
print_r(session _get_cookie_par ams()). Both old and new domain have the
same value:
Array
(
[lifetime] =0
[path] =/
[domain] =>
[secure] =>
[httponly] =>
)

I have read user notes php manual section session handling, but none
of the solution works for me.
Is it cookie problem?

Apr 10 '07 #6
>What is the domain name of the new host and the old one?
>
My old domain is sinau.dev, and the new one is op_pusat.dev. (I
use .dev for development)
Then the domains are different.
>If they
are in different domains, the browser won't send cookies (including
the session cookie) from one domain to another.
Do you have cross-links between virtual hosts?

I don't understand the meaning of 'cross-link'
Domain A contains links to pages in Domain B, and vice versa.
>It looks like you are using
host-only cookies (session.cookie _domain unset), so cookies won't
be passed by the browser between hosts.

Reading your post, I found another clue. I try to check cookies.
Tested using FF 1.5, the problem disappear (session id remains
unchanged).
Using IE6, session id always changed, even if the domain is in trusted
sites list.
>I try to get cookie info by executing
print_r(sessio n_get_cookie_pa rams()). Both old and new domain have the
same value:
Array
(
[lifetime] =0
[path] =/
[domain] =>
[secure] =>
[httponly] =>
)
Try looking at the cookie(s) on the browser. What domain(s) are they
in? There should be one cookie for each domain. Also try printing
$_COOKIE['PHPSESSID'] to see what cookie is getting sent to each page.
>I have read user notes php manual section session handling, but none
of the solution works for me.
Is it cookie problem?
If you are constantly getting new sessions on every page hit, it's
usually a cookie problem, assuming you are not trying to use
trans_sid. You can't maintain the *SAME* session between servers
in two different domains (even if it's the same server).
Apr 10 '07 #7
On Apr 10, 11:12 am, gordonb.72...@b urditt.org (Gordon Burditt) wrote:
Try looking at the cookie(s) on the browser. What domain(s) are they
in? There should be one cookie for each domain. Also try printing
$_COOKIE['PHPSESSID'] to see what cookie is getting sent to each page.
I try to execute print_r($_COOKI E);
FF: both old and new hosts print its PHPSESSID value.
IE: old host print its PHPSESSID value, and new host print empty array
(no cookies sent?).
I have read user notes php manual section session handling, but none
of the solution works for me.
Is it cookie problem?

If you are constantly getting new sessions on every page hit, it's
usually a cookie problem, assuming you are not trying to use
trans_sid. You can't maintain the *SAME* session between servers
in two different domains (even if it's the same server).
I've decided to leave this problem and use IP address since I have no
idea to solve strange IE behaviour.

Thank you very much.

Apr 10 '07 #8
Bocah Sableng wrote:
On Apr 9, 7:52 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
>What's in your Apache error log (or where ever you have your PHP errors
being logged)?

Thanks for you response.

There's no line indicating any error on my Apache error log, and the
PHP errors are not logged.

The php code I posted before seems normally executed. Here is a snip
from my Apache access log (and repeated several times) :
192.168.1.90 - - [09/Apr/2007:11:54:17 +0700] "GET /session_id.php
HTTP/1.1" 200 330

I don't know the mechanisms of session id generation. 'Cos when I move
the new virtual host at the top and accessed using its local IP
address (192.168.1.90), the problem disappears. But when accessed
using named vhost (even if the new vhost config at the top), the
problem still remain.
Should I post the vhost config? (This group is php newsgroup)

And another info:
I use 'register_globa ls=on' and also 'register_long_ arrays=on' for
backward compatibility with my ancient scripts. I know it's a bad
habit, but I use the application and the server both for intranet app
only and I don't have much time to fix all.

Thanks.
And one other thing - you are calling session_start() before ANY output
(even whitespace, DOCTYPE, etc.) in every page you need it, aren't you?

Again - I suspect you are - but sometimes the obvious gets overlooked. :-)
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Apr 10 '07 #9
>Try looking at the cookie(s) on the browser. What domain(s) are they
>in? There should be one cookie for each domain. Also try printing
$_COOKIE['PHPSESSID'] to see what cookie is getting sent to each page.

I try to execute print_r($_COOKI E);
FF: both old and new hosts print its PHPSESSID value.
Same value or two different values? I'm unclear whether you are trying
to maintain a single session across multiple servers.
>IE: old host print its PHPSESSID value, and new host print empty array
(no cookies sent?).
That's what it means, and this is likely your problem.
IE security settings are probably relevant here.
>I have read user notes php manual section session handling, but none
of the solution works for me.
Is it cookie problem?

If you are constantly getting new sessions on every page hit, it's
usually a cookie problem, assuming you are not trying to use
trans_sid. You can't maintain the *SAME* session between servers
in two different domains (even if it's the same server).

I've decided to leave this problem and use IP address since I have no
idea to solve strange IE behaviour.

Thank you very much.

Apr 10 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
8397
by: Dynamo | last post by:
Yep its me again, I have succesfully created a login page for my site. I have used the PHP_SELF so that once the user has succesfully logged on the page reloads. Everything works fine the first time somebody tries to log in but when they revisit, the log on page is bypassed and it goes straight to the information page. I have a sneaky suspicion that this is due to the fact that the page is then in their history of recently visited...
8
3368
by: DKM | last post by:
Here are the source code files to a Java applet that utilizes LiveConnect to communicate with Javascript, and the HTML file. The thing works both in IE 6.0 and FireFox 1.4. but with some problems. IE crashes when one refreshes the page or leave the page. This happens only after calling the Java method more than once. It does not crash if the Java method is called just once and then the page is refreshed. FireFox does not crash at all...
3
5692
by: michael | last post by:
Good Morning Everyone, I am writing a script to add and remove rows from a table. Here are the two functions: function newRow(rowNo) { var theTable = document.getElementById("table1"); var newRow = theTable.insertRow(rowNo);
2
1434
by: Brenden Bixler | last post by:
Hello. I've got a long web form that has to reload 6-7 times to validate data (sigh, I know) making for a rocky-enough experience for users. To add insult to injury, each time the page reloads, it loads and scrolls back to the top instead of remaining in the section that caused the page to reload. I'm looking for a way to ensure that when a dropdown box is changed near the bottom of the form (2 screens down from the top) that the page...
0
1293
by: TMT32 | last post by:
Hi, This is my first time using treeview in asp.net, but there has a problem is how to keep treeview expand status after page reload with new parameter ? Becasue it only can choose expand level depth, can't expand per parent node depath level. Please help. TMT32
1
1667
by: David C | last post by:
Is it possible to have an aspx page reload every nn minutes? I assume I would have to do something in Javascript at the client? I want my ASP.Net application to display running dollars collected and I have the code to do that in the Page_Load but I need a timed postback. Thanks. David
2
2155
by: ramanaths | last post by:
Hi I have a page that shows many thumbnail images. on load of this page i have some code that invokes a javascript which shows a message saying 'loading images'... this is hidden once all the page/images loads fully. when i navigate to some other page and then hit the back button of the browser the javascript fires and i get the 'loading images'. the images load fast (maybe from cache). but i was thinking i shouldn't be getting the 'loading...
1
3400
by: pendem | last post by:
I mean can set a variable value in a script to be unchanged even after page reload? for example if i set a value of a global variable "val" to 2 ; so using onbeforeunload() or onunload(), i will change the value of variable "val" to 5; so can i in anyway get the value of variable "val" equal to 5? after loading the page..,i mean after onload() event is done/ does my question make any sense? thnx..
5
3577
by: raamay | last post by:
i have a form via which new users can register their information along with their Resume. Now when input validation is done, if there is some errors, then the page is reloaded with the users information retained for necessary correction. In this process i find the file name and local path missing every time. So, how should we retain the local file path during page reload.
0
7927
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8220
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8352
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7981
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6632
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5396
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3846
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2367
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1194
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.