Jump to content

Recommended Posts

Hi all, I'm using XAMPP on my computers to setup a local server to test my code (both on linux and XP), I installed both at the same time (so the two should be the same version) i did not change any of the default setting. The problem is that my website contains a bit session, my code works perfectly fine on the XP system, whereas on the linux system the information that i store with session can't carry on to the other page.

the php.ini file for my xampp of my windows system
[session]
session.save_handler = files

session.save_path = "C:\xampp\tmp"

session.use_cookies = 1

session.name = PHPSESSID

session.auto_start = 0

session.cookie_lifetime = 0

session.cookie_path = /

session.cookie_domain =

session.serialize_handler = php

session.gc_probability = 1

session.gc_maxlifetime = 1440

session.bug_compat_42 = 1
session.bug_compat_warn = 1

session.referer_check =

session.entropy_length = 0

session.entropy_file =

session.cache_limiter = nocache

session.cache_expire = 180

session.use_trans_sid = 0

session.hash_function = 0

session.hash_bits_per_character = 4

url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=,fieldset="

 

the php.ini session setting of xampp of my windows machine
[session]
session.save_handler = files

session.save_path = /tmp

session.use_cookies = 1

session.name = PHPSESSID

session.auto_start = 0

session.cookie_lifetime = 0

session.cookie_path = /

session.cookie_domain =

session.serialize_handler = php

session.gc_probability = 1

session.gc_maxlifetime = 1440

session.referer_check =

session.entropy_length = 0

session.entropy_file =

session.cache_limiter = nocache

session.cache_expire = 180

session.use_trans_sid = 1

url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"

 

any suggestion???  ;D

Add the following two lines immediately after your first <?php tag on the page where you set up any session variables and on any page that references the session variables and they don't work -

 

ini_set ("display_errors", "1");
error_reporting(E_ALL);

 

Also, post an example of your code. You might be doing something server configuration specific having nothing to do with the session settings.

Just to make my problem clear, I run the same exact codes on a windows system and a linux system with the same version of XAMPP, but only the window one works.

 

This is the 1st page where the session values are defined. I tested the variables in this page and they all work fine.

<?php session_start(); ?>
<html>
<body>
..
..
..
..
if ($redo != 0)
{

$_SESSION['redo'] = $redo;
$_SESSION['username'] = $_POST["username"];

echo '<META HTTP-EQUIV="refresh" CONTENT="0;register.php" />';
}
..
..
</body>
</html>

 

This is the code for the page that i have problem with. Where the value of session passed from the other page is lost.

 

<?php 
session_start(); 
$redo = 0;
if (isset($_SESSION['redo'])) 
  {
    $redo = $_SESSION['redo'];
    if ($redo == 2) $usr = $_SESSION['username'];
  }
$redo = $_SESSION['redo'];
?>

<html>
<body>
<h1>User register</h1>
<form action="checkinput.php" method="post">
<font size="4" face="Times">
User Name: <input type="text" name="username" value="<?php if ($redo == 2) echo $usr;?>"/>
<?php if (($redo == 1)||($redo == 3))  echo "     Sorry, the user name is taken.".'</br>'; 
else 
echo '</br>';
?>
</br>

Password: <input type="password" name="pwd" size="50"/>
<?php if (($redo == 2)||($redo == 3))  echo "     Please input the password correctly.".'</br>'; 
else 
echo '</br>';
?>
</br>

Comfirm Password: <input type="password" name="cpwd" size="50"/>
</br>

<input type="submit">
</form>
</font>
</body>
</html>

Add the following two lines immediately after your first <?php tag on the page where you set up any session variables and on any page that references the session variables and they don't work -

 

ini_set ("display_errors", "1");
error_reporting(E_ALL);

 

If you are not going to follow the advice that was given, it is going to take a really long time to find what the problem is. ::)

Could you post the first 4-5 lines of current code in both files?

 

Lacking all your code to be able to duplicate the problem, my next best guess is a register_globals problem (variables of the same name overwriting each other.) What does a phpinfo(); statement show for the register_globals setting on each system?

I put in what you suggested. They both start with,

<?php 
ini_set ("display_errors", "1");
error_reporting(E_ALL);
session_start(); ?>
<html>

 

"Lacking all your code to be able to duplicate the problem, my next best guess is a register_globals problem (variables of the same name overwriting each other.) What does a phpinfo(); statement show for the register_globals setting on each system?"

 

I don't understand that, sorry i'm too noob. :(

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.