473,397 Members | 2,077 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Session Variables in Red Hat?

Hi,

I am attempting to use php session variables on a server which is running Red Hat Linux, but the variables don't seem to be getting passed between pages. I have tried the same exact test script on my third party webhost, and it works just fine. Does anyone know of anything that needs to be changed in a default Red Hat php setup?

This is the test script that I am using:
http://php.about.com/od/advancedphp/ss/php_sessions.htm

This is what I was given as the default setup for redhat:
Expand|Select|Wrap|Line Numbers
  1. [Session]
  2. ; Handler used to store/retrieve data.
  3. session.save_handler = files
  4.  
  5. ; Argument passed to save_handler.  In the case of files, this is the path
  6. ; where data files are stored. Note: Windows users have to change this
  7. ; variable in order to use PHP's session functions.
  8. session.save_path = /var/lib/php/session
  9.  
  10. ; Whether to use cookies.
  11. session.use_cookies = 1
  12.  
  13. ; This option enables administrators to make their users invulnerable to
  14. ; attacks which involve passing session ids in URLs; defaults to 0.
  15. ; session.use_only_cookies = 1
  16.  
  17. ; Name of the session (used as cookie name).
  18. session.name = PHPSESSID
  19.  
  20. ; Initialize session on request startup.
  21. session.auto_start = 0
  22.  
  23. ; Lifetime in seconds of cookie or, if 0, until browser is restarted.
  24. session.cookie_lifetime = 0
  25.  
  26. ; The path for which the cookie is valid.
  27. session.cookie_path = /
  28.  
  29. ; The domain for which the cookie is valid.
  30. session.cookie_domain =
  31.  
  32. ; Handler used to serialize data.  php is the standard serializer of PHP.
  33. session.serialize_handler = php
  34.  
  35. ; Define the probability that the 'garbage collection' process is started
  36. ; on every session initialization.
  37. ; The probability is calculated by using gc_probability/gc_divisor,
  38. ; e.g. 1/100 means there is a 1% chance that the GC process starts
  39. ; on each request.
  40.  
  41. session.gc_probability = 1
  42. session.gc_divisor     = 1000
  43.  
  44. ; After this number of seconds, stored data will be seen as 'garbage' and
  45. ; cleaned up by the garbage collection process.
  46. session.gc_maxlifetime = 1440
  47.  
  48. ; PHP 4.2 and less have an undocumented feature/bug that allows you to
  49. ; to initialize a session variable in the global scope, albeit register_globals
  50. ; is disabled.  PHP 4.3 and later will warn you, if this feature is used.
  51. ; You can disable the feature and the warning separately. At this time,
  52. ; the warning is only displayed, if bug_compat_42 is enabled.
  53.  
  54. session.bug_compat_42 = 0
  55. session.bug_compat_warn = 1
  56.  
  57. ; Check HTTP Referer to invalidate externally stored URLs containing ids.
  58. ; HTTP_REFERER has to contain this substring for the session to be
  59. ; considered as valid.
  60. session.referer_check =
  61.  
  62. ; How many bytes to read from the file.
  63. session.entropy_length = 0
  64.  
  65. ; Specified here to create the session id.
  66. session.entropy_file =
  67.  
  68. ;session.entropy_length = 16
  69.  
  70. ;session.entropy_file = /dev/urandom
  71.  
  72. ; Set to {nocache,private,public,} to determine HTTP caching aspects.
  73. ; or leave this empty to avoid sending anti-caching headers.
  74. session.cache_limiter = nocache
  75.  
  76. ; Document expires after n minutes.
  77. session.cache_expire = 180
  78.  
  79. ; trans sid support is disabled by default.
  80. ; Use of trans sid may risk your users security.
  81. ; Use this option with caution.
  82. ; - User may send URL contains active session ID
  83. ;   to other person via. email/irc/etc.
  84. ; - URL that contains active session ID may be stored
  85. ;   in publically accessible computer.
  86. ; - User may access your site with the same session ID
  87. ;   always using URL stored in browser's history or bookmarks.
  88. session.use_trans_sid = 0
  89.  
  90. ; The URL rewriter will look for URLs in a defined set of HTML tags.
  91. ; form/fieldset are special; if you include them here, the rewriter will
  92. ; add a hidden <input> field with the info which is otherwise appended
  93. ; to URLs.  If you want XHTML conformity, remove the form entry.
  94. ; Note that all valid entries require a "=", even if no value follows.
  95. url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
  96.  
Thanks for any help that you can provide.

Mike
Aug 8 '07 #1
3 3090
epots9
1,351 Expert 1GB
Hi,

I am attempting to use php session variables on a server which is running Red Hat Linux, but the variables don't seem to be getting passed between pages. I have tried the same exact test script on my third party webhost, and it works just fine. Does anyone know of anything that needs to be changed in a default Red Hat php setup?

This is the test script that I am using:
http://php.about.com/od/advancedphp/ss/php_sessions.htm

This is what I was given as the default setup for redhat:
<snip>
Thanks for any help that you can provide.

Mike
Hi mikeboston welcome to TSDN,

can we see the php code that u are using to set the sessions and the php code where u are trying to access them.

thank you
Aug 8 '07 #2
Hi mikeboston welcome to TSDN,

can we see the php code that u are using to set the sessions and the php code where u are trying to access them.

thank you
Hi Epots, yes, the code is the exact code that you find at that link above. The link goes to a php session variables tutorial. Here is the script in action, working just fine: http://gurry.com/session

Thanks,
Mike

page 1:
Expand|Select|Wrap|Line Numbers
  1. <?php 
  2. session_start(); 
  3.  
  4. // makes an array 
  5. $colors=array('red', 'yellow', 'blue'); 
  6. // adds it to our session 
  7. $_SESSION['color']=$colors; 
  8. $_SESSION['size']='small'; 
  9. $_SESSION['shape']='round'; 
  10. print "Done";
  11. ?>
  12.  
  13.  
  14. page 2:
  15. <?php 
  16. session_start(); 
  17. Print_r ($_SESSION);
  18. echo "<p>";
  19.  
  20. //echo a single entry from the array
  21. echo $_SESSION['color'][2];
  22. ?>
  23.  
Aug 8 '07 #3
Atli
5,058 Expert 4TB
This is most likely a problem with your PHP configuration.

Try adding this to the top of your page, after the session_start() function call:
Expand|Select|Wrap|Line Numbers
  1. echo "<p>". session_id() ."</p>";
  2.  
This will print the session id, which should stay the same throughout the session.
Aug 8 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Al Jones | last post by:
This is a repost form the vbscript newgroup - if this isn't the appropriate group would you point me toward one that is. Basically, I seem to be losing session data part way though preparing an...
6
by: Lina Manjarres | last post by:
Hello, I have a session variable in a login page. Then I go to a form page where I uses the ProfileID and the UserID. Then I go to a result page where I would like to use the UserID as a filter,...
4
by: PJ | last post by:
A particular page seems to be having issues with correctly setting Session variables. I am setting a couple of session variables on the Page_Unload event. While stepping through code, the...
31
by: Harry Simpson | last post by:
I've come from the old ASP camp where session variables were not used. When i started using ASP.NET in 2001, I started using them again because it was ok from what I'd read. I've been merrily...
10
by: tshad | last post by:
I have been using the default session state (InProc) and have found that I have been loosing my information after a period of time (normally 20 minutes). Is there anyway to find out how much...
3
by: Alan Wang | last post by:
Hi there, Once my application gets complicated and complicated. I found it's really hard to keep track of Session value I am using in my asp.net application. I am just wondering if anyone have...
3
by: Phillip N Rounds | last post by:
I'm writing a user control which has two states: Active & InActive. I additionally am required that there to be only one active control per page, and all logic has to be contained within the...
18
by: BillE | last post by:
When a user opens a new IE browser window using File-New-Window the integrity of an application which relies on session state is COMPLETELY undermined. Anyone who overlooks the fact that...
26
by: BillE | last post by:
Some ASP.NET applications use Session Variables extensively to maintain state. These should be re-written to use viewstate, hidden fields, querystring, etc. instead. This is because if a user...
12
by: MrHelpMe | last post by:
Hello again all, I've finished my whole application and now I don't like the whole session variables that I am using. I have a form, user fills in info clicks submit and using CDOSYSMail an...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.