Solved

Loosing the session data of PHP on Linux - Apache Configuration

Posted on 2006-06-27
7
199 Views
Last Modified: 2013-12-12

Hi All,
          The following code worked well with WinXP-IIS combination.  But the same code is not working with Linux-Apache combination.  

That is the $_SESSION["msg"] in the pgm2.php has no data (loosing session data).

Any idea?  Do we need to do any configuration settings on the Linux/PHP front?


pgm1.php:
===========================================================
<?
session_start();
$_SESSION["msg"]="Hello World";
?>
<html>
     <form name="testform" method="post" action="pgm2.php">
          Name: <input type="text" name="txt_name"><br>
          <input type="submit" name="btn_submit" value="Submit">
     </form>
</html>


pgm2.php:
===========================================================
<?
session_start();
echo "The data in the session variable 'msg' is: ".$_SESSION["msg"];
?>

0
Comment
Question by:Anupama_2005
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
7 Comments
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 16991454
Create a script ...

<?php phpinfo(); ?>

And load this on both platforms.

The look at the settings related to session.

What's different?
0
 

Author Comment

by:Anupama_2005
ID: 16998429
Hi,
         Thanks for your reply. I am herewith giving the data related to sessions on both the machines.


On WinXP-IIS combination:
===================

Session Support  enabled  
Registered save handlers  files user sqlite  
Registered serializer handlers  php php_binary wddx


session.auto_start Off Off
session.bug_compat_42 On On
session.bug_compat_warn Off Off
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
session.name PHPSESSID PHPSESSID
session.referer_check no value no value
session.save_handler files files
session.save_path C:\PHP\sessiondata C:\PHP\sessiondata
session.serialize_handler php php
session.use_cookies On On
session.use_only_cookies Off Off
session.use_trans_sid 0 0


On Linux-Apache combination:
====================

Session Support  enabled  
Registered save handlers  files user sqlite
 
Registered serializer handlers  php php_binary  

session.auto_start Off Off

->session.bug_compat_42 Off Off

session.bug_compat_warn Off Off
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 1000 1000
session.gc_maxlifetime 1440 1440
session.gc_probability 1 1
session.hash_bits_per_character 5 5
session.hash_function 0 0
session.name PHPSESSID PHPSESSID
session.referer_check no value no value
session.save_handler files files
session.save_path /var/lib/php/session /var/lib/php/session
session.serialize_handler php php
session.use_cookies On On
session.use_only_cookies Off Off
session.use_trans_sid 0 0

Please do let me know if you need any further details.

Many Thanks


0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 16999247
What version of PHP are you using on the two platforms?
0
 
LVL 40

Accepted Solution

by:
Richard Quadling earned 500 total points
ID: 16999255
session.bug_compat_42 boolean
PHP versions 4.2.3 and lower have an undocumented feature/bug that allows you to initialize a session variable in the global scope, albeit register_globals is disabled. PHP 4.3.0 and later will warn you, if this feature is used, and if session.bug_compat_warn is also enabled. This feature/bug can be disabled by disabling this directive.

session.bug_compat_warn boolean
PHP versions 4.2.3 and lower have an undocumented feature/bug that allows you to initialize a session variable in the global scope, albeit register_globals is disabled. PHP 4.3.0 and later will warn you, if this feature is used by enabling both session.bug_compat_42 and session.bug_compat_warn.



0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question