Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Loosing the session data of PHP on Linux - Apache Configuration

Posted on 2006-06-27
7
Medium Priority
?
219 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 2000 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
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 create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

715 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