473,810 Members | 3,137 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PHP Sessions doesn't work on my localhost

On my computer, whenever a new page is opened, a new session id will be
created instead of accessing the same session id.

When I upload everything on my webhost, it seems to work normal. So
there's no problem with my code. But I want it to work on my local
machine too, because it's better for me to program my website.

I've PHP running on my IIS server ( so, it's not Apache ). Is that the
problem? I've heard about a problem with sessions under IIS. Or do I
have incorrect settings in my php.ini.

Can someone help my. I don't know what to do anymore. If it's the IIS
problem, can it be fixed under IIS?

Aug 10 '05 #1
5 12050
*** Tommy DN wrote/escribió (10 Aug 2005 13:25:05 -0700):
Or do I have incorrect settings in my php.ini.


At a minimum, the session save directory should exist. Does it?
--
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--
Aug 11 '05 #2
Alvaro G Vicario schreef:
*** Tommy DN wrote/escribió (10 Aug 2005 13:25:05 -0700):
Or do I have incorrect settings in my php.ini.


At a minimum, the session save directory should exist. Does it?


Yes, my sessions directory is in " c:\php\sess\ " and all files are
saved in it. But when you refresh the page of when you come to another
page where the session is initilized ( with session_start() ), a new
file will be created in it instead of using the same session.

Aug 11 '05 #3
*** Tommy DN wrote/escribió (11 Aug 2005 03:23:58 -0700):
Yes, my sessions directory is in " c:\php\sess\ " and all files are
saved in it. But when you refresh the page of when you come to another
page where the session is initilized ( with session_start() ), a new
file will be created in it instead of using the same session.


Then it seems your web browser is not storing session cookies. Does it
happen with all browsers?

HTTP headers can be helpful for troubleshooting . You can see them with the
'Live HTTP Headers' extension (available for Mozilla and, probably,
Firefox).

--
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--
Aug 11 '05 #4
I have the exact same problem except I run apache.

It started when my hard drive recently crashed. I had been on win 2000
but when I installed the new drive I updated to XP. I then reloaded
Apache, PHP and MySQL, all the latest versions (this was in June).

Since then, when I run PHP pages on my machine, I have found that the
sessions are not maintaining from page to page. When I run the same
scripts on my ISP they work perfectly though.

I did find that in some instances if I put the session ID in the url I
can get things to work. But otherwise the session changes each time I
change or reload the page.

My initial assumptions are that I have some setting wrong in php.ini or
the appache configuration or there's some interaction with XP.

Did you come up with any solutions yet?

Thanks,
Jonathan

Aug 14 '05 #5
eddie12208
1 New Member
I had the same problem you had:
My sessions would start just fine, and a session file would be created and written to disk. (BTW, I'm on a win XP box, Apache 2.0.54, PHP version 5.0.4.) However, next time I loaded the page, the old session would not be used. Instead, a NEW session was created. For me, this happened no matter what computer I was using, whether it was the server (localhost) or a client (remote). A new session was created EVERY TIME I loaded the page.. it was annoying. After a few hours of googling, I gave up and decided to mess around in the php.ini file. I changed this line:
session.cookie_ path = /
to this:
session.cookie_ path =

I havent tried many things but I think maybe it is because windows needs backslashes (\) instead of forward slashes (/), and if you just leave it blank, it turns out ok.

hope this helps.
Aug 17 '05 #6

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

Similar topics

2
10187
by: Dave Mateer | last post by:
Hi Why does the following code allow me to keep the same session when in the same sub domain (ie admin.localhost), yet not when I goto another related domain eg main.localhost? I would like to have the same session on the related domain. I bet the solution is really simple <grin>!... Kind Regards
8
12706
by: Steve Fitzgerald | last post by:
The below login script does work. The form does not seem to be submitting. I keep getting the username and password fields. The only errors I get are notices that email and password and undefined indexes. Here's the login script: <?php session_start(); // includes
3
2380
by: Simon K | last post by:
Hi I am working with sessions to check if the user is logged in. This usually works fine and all my .asp-pages checks if: <% session.Contents("loggedIn")=True %> But this only works on my web-hotel When I run the same pages on my localhost, it can't find any sessions and I appear to not be logged In. I have tried to set my localhost on the "trusted sites" list and "always allow" in "override cookie handling" in my Explorer. But no luck....
5
673
by: Rob | last post by:
I have an ASP.NET application that uses forms-based authentication. A user wishes to be able to run multiple sessions of this application simultaneously from the user's client machine. The web.config file is configured as such: <authentication mode="Forms"> <forms loginUrl="Login.aspx" protection="All" name="myApplication"/> </authentication>
0
1345
by: Jerad Rose | last post by:
I have an odd scenario. I am working on a hybrid site that uses various development platforms, namely traditional ASP and Lasso (a Mac scripting language). The site uses its own custom sessions stored in a mySQL database, and state is maintained through the URL, passing a session GUID in the URL between page calls. For example: http://localhost/index.html?-session=42FFA3821db04174BBRxjX1B4B48
1
5213
by: Duncan | last post by:
I have a strange problem with sessions in PHP 5. I have a simple script that prints a random number both as a string and a picture on the screen. When I run the script for the first time, it works perfectly. However, when I refresh the page, new updated random number does not propagate to the image displayer script through sessions. The image displayer script continues showing the old number instead of the new random number. I checked the...
7
296
by: Nico | last post by:
Dear all, I made the following form. <FORM METHOD="POST" ACTION="prova.php"> <b>Combination</b><br><br> Element 1: <INPUT NAME="el1" TYPE="TEXT"> <BR> Element 2: <INPUT NAME="el2" TYPE="TEXT"> <br>
41
3255
by: amygdala | last post by:
Hello all, I have posted a similar question in comp.lang.php in the past, but haven't had any response to it then. I kinda swept the problem under the rug since then. But I would really like to resolve this issue once and for all now. The problem might be PHP related but since I only develop applications using PHP, I'm not a hundred percent sure. Therefor I've taken the liberty to crosspost to comp.lang.php and alt.www.webmaster. I...
7
2389
by: pek | last post by:
OK, I've been having this problem for quite some time but never until now I really needed a solution. I have never thought of a work around, so I really need your help. Sorry if this has been mentioned already. You can point me to the post and I'll gladly read. I googled this a lot but, first, most people have tutorials for sharing sessions in subdomains, and, second, I have no clue what keywords to use. I am currently developing two web...
0
9722
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
10124
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
9200
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...
1
7664
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6882
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
5550
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...
0
5690
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3863
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3015
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.