Solved

Loosing the session data of PHP on Linux - Apache Configuration

Posted on 2006-06-27
7
192 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
  • 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

785 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