[Last Call] Learn how to a build a cloud-first strategyRegister Now


PHP SESSION doesn't pass value to sub or upper directory on Linux

Posted on 2009-02-12
Medium Priority
Last Modified: 2013-12-13
Hi guys,
I have a problem but I don't know why and where to look at it.
I have a php script in main directory and the script include a php file in the sub-directory. The file in the main directory is called index.php and the include file is login.php. Index.php calls login function and the function generates $_SESSION['user']. The problem is that the session value is stays in the sub-directory where the fuction is. I tested the session value and the session value was created but I cannot use the session in the main directory. I have some other php scripts in the same sub directory and they are passing the session value but not second sub directory and main directory. The session value stays in same folder where it was created. I checked same scripts on the XP and it works fine. In this case, where should I look for?
Question by:yong615
1 Comment

Accepted Solution

digital0iced0 earned 2000 total points
ID: 23630252
The session should not be affected by the directory its in.  I'd make sure there's a session_start() at the top of every page.  Also make sure you have the correct file and folder permissions.  Also make sure that one of your scripts isn't unsetting the session value you are looking for.  It's hard to say since you did not post that much information.  Can you post the actual scripts?

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

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

I have put this article together as i needed to get all the information that might be available already into one general document that could be referenced once without searching the Internet for the different pieces. I have had a few issues where…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to count occurrences of each item in an array.
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…
Suggested Courses
Course of the Month18 days, 14 hours left to enroll

834 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