473,811 Members | 2,856 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Session Variables in Red Hat?

2 New Member
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 3118
epots9
1,351 Recognized Expert Top Contributor
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
mikeboston
2 New Member
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 Recognized Expert Expert
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
2394
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 email from (possibly) three seperate forms. the following code is the end of a routine which stashes data from the first form off to session variables and then redirects itself to the proper form / procedure depending upon the state of two...
6
656
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, but I can't get the value is stored in it. How can I do that? Thanks a lot!
4
5597
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 immediate window will show the values in Session after the relevant lines that set the variables in the Page_Unload event. However, on postback, these variables are no longer in Session. All Session variables that were set previous to that particular...
31
7013
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 using Session variables for three years now and i'm entering a project with my new boss who has never quite come around that session variables are ok. What's the concensus here. How can i convince him that they are ok in ASP.NET. OR
10
3522
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 more time I have on a session? If I do a refresh, does reset the session clock? Do you have have to go to another page to reset the session timeout or will a postback also do it? This is important as we have a few pages that a user
3
2915
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 any experience on how to keep track of session value. Any help it's appreciated. Thanks Alan
3
2683
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 control. In its inactive state, only a single button appears. If the user clicks on this button, the control becomes active( the rest of the control's functionality becomes visible), and all other instances of this user control on the page should...
18
3450
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 File-New-Window creates an instance of IE in the same process with the same SessionID as the parent window is in big trouble. This fundamentally restricts the usefullness of using session state management. I probably missed it somewhere - can...
26
3622
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 opens a new IE window with Ctrl-N or File-New-Window, BOTH WINDOWS SHARE THE SAME SESSION VARIABLES. This cannot be prevented.
12
3850
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 email link gets created with an encoded query string. i.e http://www.yahoo.ca?#$@%@&#%#$@&^@%# which translates into http://www.yahoo.ca?userID=54&LocationID=Denver. Now when the user get's this email and clicks on the link I have a
0
9722
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9603
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10644
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10379
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10393
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10124
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6882
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
3015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.