473,388 Members | 1,346 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Two servers, two different results with session variables?

Hello

I'm new to PHP session variables, and I'm doing some work for a client whose website uses session variables in a form that contains image verification. There's a problem with the form - it appears that a session variable is being forgotten. So I wrote this quick test script to investigate:

Expand|Select|Wrap|Line Numbers
  1. $html = "Pre session start - myvalue = " . $_SESSION['myvalue'] . "<br /><br />";
  2. session_start();
  3. $html .= "Post session start - myvalue = " . $_SESSION['myvalue'] . "<br /><br />";
  4. $_SESSION['myvalue'] = str_shuffle('abcdefg');
  5. $html .= "Just set myvalue = " . $_SESSION['myvalue'] . "<br /><br />";
  6. echo $html;
Now, on my own website, each time I refresh the page, the code at line 1 prints an empty value (as expected); the code at line 3 prints the session variable set the previous time I viewed the page; and the code at line 5 prints the value of the session variable set this time round.

On my client's server, though, line 3 always returns an empty value - as if the session variable, or the whole session, is being forgotten between page refreshes. Apologies if this is a stupid question, but can anyone give me any pointers as to what might have changed recently on my client's server to have caused this problem?

Many thanks

Dave
Jul 24 '07 #1
4 1572
pbmods
5,821 Expert 4TB
Heya, Dave. Welcome to TSDN!

If your code doesn't change, but the results do, check the php.ini file on each server. You might have incorrect cookie settings, for example, that might cause session info not to get saved.
Jul 25 '07 #2
Heya, Dave. Welcome to TSDN!

If your code doesn't change, but the results do, check the php.ini file on each server. You might have incorrect cookie settings, for example, that might cause session info not to get saved.
I've emailed the guys responsible for the server, we'll see what they say. Thanks for the hint, and well done for the forum!

Dave
Jul 25 '07 #3
I've emailed the guys responsible for the server, we'll see what they say.
...And in fact it was the aftermath of some changes made to permissions on the server, which I didn't know about. Sorry to waste your time guys, but thanks again for the response, you helped me ask some useful questions. Have a good weekend...

D
Jul 26 '07 #4
pbmods
5,821 Expert 4TB
Heya, Dave.

Glad to hear you got it working! Good luck with your project, and if you ever need anything, post back anytime :)
Jul 26 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: AbeR | last post by:
I have written a fairly simple reporting app that has been working for a few years without any issues until this past week. The application has a login page with a DSN lookup for login/password...
10
by: Brent | last post by:
Hi, I have a problem. We have web applications on 2 seperate servers that need to talk to each other. App 1 needs to pop open a second windos with App2 in it where you choose a value and that is...
3
by: John Sheppard | last post by:
Hello, I was wondering if anyone knew how to send session variables between two different servers... My web host gives me two servers, one normal server and one that has SSL on it. When my web...
1
by: abhijit | last post by:
Hi Xperts, I have multiple Web Sites in different Live Servers. I want to login any of the sites, and then I will access all the other sites without giving any more login information (i.e I want...
1
by: Pronojit Roy | last post by:
Hi Xperts, I have multiple Web Sites in different Live Servers. I want to login any of the sites, and then I will access all the other sites without giving any more login information (i.e I want...
1
by: David Gaudine | last post by:
(This is a bit like the recent thread "PHP Switching Sessions".) I use session_start(). When I open my web-based application in two windows on the same system, there's a definite clash; I can't...
3
by: Venkat | last post by:
Hi, Ours is a windows based application and I have to perform an action which takes much time (as it requires much CPU time) on a single pc. I want to split the action to more than two and I...
13
by: Samir Chouaieb | last post by:
Hello, I am trying to find a solution to a login mechanism for different domains on different servers with PHP5. I have one main domain with the user data and several other domains that need...
1
by: Andy | last post by:
I want to store a key in an ASP.NET session variable that points to an ASP.NET page cache. The page cache contains an XML document that holds a draft of the user's work. After the user is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...

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.