473,788 Members | 2,743 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Session variables not working in PHP 5.0.4

28 New Member
Hi All,
I have a web site which was hosted on m/c A and PHP version there was 4.4.3
Now I have moved my website to m/c B and the PHP version is 5.0.4
But now the problem is that the on the m/c B my session variables(HTTP session variables) used in the PHP code are not maintained across all the pages which is creating problem on my website.
I have put the exact code in m/c B which was there in m/c A and was working perfectly.

Am I missing here??
I am not sure but do I ned to make any changes in my ini file on m/c B?

Please Help.

Regards,
Hussain
Nov 15 '07 #1
4 4091
Atli
5,058 Recognized Expert Expert
Hi Hussain.

Could you show us how the code you use to create and use your session variables?
Nov 16 '07 #2
hussain123
28 New Member
Expand|Select|Wrap|Line Numbers
  1. <?
  2. //first page
  3. session_start();
  4. session_register('variable');
  5.  
  6. $HTTP_SESSION_VARS['variable']= value;
  7. ?>
  8. <html>
  9. <body>
  10. <a href="page2.php">Page2</a>
  11. </body>
  12. </html>
  13.  
Expand|Select|Wrap|Line Numbers
  1. <?
  2. //page 2
  3. $newvariable = $HTTP_SESSION_VARS['variable'];
  4.  
  5. echo $newvariable;
  6. ?>
  7.  
Thanks,
Hussain
Nov 16 '07 #3
Atli
5,058 Recognized Expert Expert
Ahh, I see.

The $HTTP_SESSION_V ARS array is old and really should not be used.
Use the $_SESSION super-global instead.

I'm not really sure this will fix the problem, but it is a good place to start.

Also, I recommend using <?php ... ?> instead of <? ... ?>. The short-tags version can cause problems when moving between servers.

Consider this:
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. //first page
  3. session_start();
  4.  
  5. $_SESSION['variable'] = "Some value";
  6. ?>
  7.  
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. //page 2
  3. $newvariable = $_SESSION['variable'];
  4.  
  5. echo $newvariable;
  6. ?>
  7.  
P.S.
Please post all your code inside [code] tags.

[code=php] PHP Code goes here [/code]

Thank you.
Nov 16 '07 #4
LacrosseB0ss
113 New Member
I'm also having this problem. This post is mostly so I can subscribe and watch for answers here that may help me as well. Thanks!
Nov 17 '07 #5

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

Similar topics

1
2730
by: gfuller | last post by:
- We have 2 aspx pages in a .NET project. The first sets a session variable and has a button that when clicked performs a 'redirect' to the second page which then reads the session variable. Problem: This always works fine on the localserver and through the IDE. But when the application is put onto a www website, the following occurs; - If you browse to the site using the IP address, session variables work fine
9
3335
by: Larry Woods | last post by:
I have a site that works fine for days, then suddenly, I start getting ASP 0115 errors with an indication that session variables IN SEPARATE SESSIONS have disappeared! First, for background information, I have a customized 500-100 page that sends the value of various session variables via email to my support site. The situation: On the home page of the site, the FIRST THING that is done is a Session
14
3240
by: Paul Yanzick | last post by:
Hello, I am trying to develop a book tracking application for my capstone in school, and am running into a problem. The application is an ASP.Net application written in C#. The first page you go to is a login form, which will set several session variables with the name used to log in, appropriate security level and some other misc variables, and then will go to a main menu for each particular security level using Server.Transfer. ...
3
2638
by: Rob | last post by:
I'm trying to use session variables to store datasets when moving from page to page (and returning). The datasets are small (I know some may comment on performance issues). It seems simple to use. I can pass a dataset to the second page (once I get one additional page working, the rest will be simple) successfully but am not able to return to the default page and retrieve the dataset and rebind it to my datagrid. Once I store it as a...
1
2415
by: dsmith-nospam | last post by:
Hello, It would be great if someone knows the answer to this problem I'm getting bogged down with it. Basically I'm working with an ASP.NET solution that uses the Session object to maintain state. When I use IIS to browse the .aspx pages the session state works but when I step through the code with Visual Studio's debugger the session variables are lost although the session ID stays the same. When I say the session variables are lost,...
2
2289
by: Stuart | last post by:
Hi there I am using several processes within an .asp application that store variables in to session - typically: Session("UniqueName") = Value I am having a hell of a time overwriting the Session value once it has been stored the first time - namely I can't
5
1687
by: Terry On Windigo | last post by:
I think I have figured out my problem but I don't know how to solve it. We are going to start using a forums package and do not want our users to have to login to both our site, and then again to the forums package. The creator of the forums package provides what seems to be an easy workaround for this. Create two session variables, one for ID, the other for Password, and his program will take care of the rest. I have all of my forums...
6
5169
by: =?Utf-8?B?U2hhd24gU2VzbmE=?= | last post by:
Greetings! I was researching AJAX to provide a solution to displaying status messages while a long process executed. I found several examples online and was able to use their code to get a quick application working. However, when attempting to implement the solution, the AJAX calls weren't updating the screen like the examples were and seemed not to fire until after the long running process had completed. I found the only real...
6
3783
by: ChrisAtWokingham | last post by:
I have been struggling with unexpected error messages on an ASP.NET system, using SQL and C#. The application draws organisation charts, based on data stored in the SQL database. Some of the chart editing processes place a very heavy load on the server as the effects of the edit ripple through the organisation structure, requiring potentially large numbers of rows in one of the tables to be updated. (I have done it this way to make the more...
0
1382
by: mfaisalwarraich | last post by:
Hi Everybody, I am submitting a form to the paypal and then returning to a url. return to the url is successful means the code is workin properly. but at the return url im having this 500 CGI error and it also not containing any values in the session variables. as im getting records and updating records if the return is successfull from paypal depending upon the session variables. this is working fine at my server where i hosted it. but...
0
9656
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
9498
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9969
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8995
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
6750
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
5538
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4074
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
2
3677
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2896
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.