Sessions don't work using XAMPP! Please help!

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Sessions don't work using XAMPP! Please help!

Postby Tigervlc » 03. November 2005 11:26

Hello, I installed Apache+PHP+MySQL in two PC's. The first one, I did it manually, and sessions work perfectly. I used XAMPP in the second one. And everything was ok, until I began to use sessions.

What it's happening is something really strange. The defined path to save my session ID's was this (XAMPP did it automatically):
session.save_path = "D:/XAMPP/tmp"

This doesn't seem to have much importance, as sessions fail whatever the save_path is.

The thing is that when I start a session from for instance page1.php, a file containing the session ID is created in the save_path directory. Next, I call page2.php from page1.php and I try to recover the session variable I created in page1.php. Well...surprisingly, PHP creates another file with no content, instead of reading the values within the first ID file, or cookie, if I can call it like this. As a result, page2.php can't read the session variable and it is not echoed on screen.

I've asked on many forums, and the config. of my php.ini seems to be ok. So I started to think it XAMPP has anything to do with this. What do you think? Have anyone ever experienced problems with sessions by using XAMPP? Couls you please help me out to solve this?

Code: Select all
    $_SESSION['varSession'] = "Hello world!";
    echo 'Content of $_SESSION[\'varSession\'] is: '.$_SESSION["varSession"].'<br />';
<a href="page2.php">Next page</a>


Code: Select all
    echo 'Content of $_SESSION[\'varSession\'] is: '.$_SESSION["varSession"].'<br />';

section sessions in phpinfo():

Code: Select all
Session Support enabled
Registered save handlers files user sqlite
Registered serializer handlers php php_binary wddx

Directive Local Value Master Value
session.auto_start Off Off
session.bug_compat_42 On On
session.bug_compat_warn On On
session.cache_expire 180 180
session.cache_limiter nocache nocache
session.cookie_domain no value no value
session.cookie_lifetime 0 0
session.cookie_path / /
session.cookie_secure Off Off
session.entropy_file no value no value
session.entropy_length 0 0
session.gc_divisor 100 100
session.gc_maxlifetime 1440 1440
session.gc_probability 1 1
session.hash_bits_per_character 4 4
session.hash_function 0 0 PHPSESSID PHPSESSID
session.referer_check no value no value
session.save_handler files files
session.save_path D:\xampp\tmp D:\xampp\tmp
session.serialize_handler php php
session.use_cookies On On
session.use_only_cookies Off Off
session.use_trans_sid 0 0

Best regards!
Posts: 2
Joined: 03. November 2005 11:04

Postby Wiedmann » 03. November 2005 11:45

So I started to think it XAMPP has anything to do with this. What do you think? Have anyone ever experienced problems with sessions by using XAMPP?

I don't think so. I think you have a software installed, that blocks session cockies in your browser.
AF Moderator
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby alucard01 » 07. November 2005 07:56

1st of all, session_start() must be placed on the very first row of your html file.

When I mean "the very first row", this is the row that is start BEFORE <html> tags.


<?php session_start(); ?>

Is your code like this?

Hope it helps.
Posts: 122
Joined: 15. May 2005 13:51

Sessions not working, not to do with code.

Postby eXcalibur_lk » 05. January 2006 01:02

I don't think it has anything to do with your code layout, I have the same code running on a live server and on a copy of xampp lite.

The live server one runs with sessions without a hitch, whereas xampp lite doesn't seem to want to run sessions even though I override the sessions to write to a MySQL database.
Posts: 3
Joined: 05. January 2006 00:44

Postby spuri » 20. February 2006 15:41

i have the same problem
works on live server but doesn't on xampp 1.5.1
Posts: 6
Joined: 28. September 2005 10:29

XAMPP for linux

Postby ccoutino » 20. March 2006 21:14

I did the same for XAMPP using linux and it worked just fine. However, I have the same problem with Windows... I will be working on this to see If I can find the problem. :shock:
Posts: 2
Joined: 20. March 2006 20:55

Postby ccoutino » 20. March 2006 21:36

Modify the php.ini (located for example in "c:\xampp\apache\bin"). Look for the variable:

session.use_trans_sid = 0

and change it to:

session.use_trans_sid = 1

See if this helps.


Posts: 2
Joined: 20. March 2006 20:55

Postby spuri » 04. April 2006 17:42

sorry still does not work
Posts: 6
Joined: 28. September 2005 10:29

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 72 guests