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
Solved

Loosing the session data of PHP on Linux - Apache Configuration

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
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…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

809 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