Solved

Loosing the session data of PHP on Linux - Apache Configuration

Posted on 2006-06-27
7
186 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:RQuadling
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:RQuadling
ID: 16999247
What version of PHP are you using on the two platforms?
0
 
LVL 40

Accepted Solution

by:
RQuadling 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

705 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now