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

Posted on 2009-02-12
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
    LVL 6

    Accepted Solution

    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?

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Free Trending Threat Insights Every Day

    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.

    Suggested Solutions

    Introduction: Sometimes when I receive a call from my users to solve their problems it is very difficult for me to found their computer IP address. Even finding their computer Host to provide remote support can be a problem.  So I resorted to Goo…
    These days socially coordinated efforts have turned into a critical requirement for enterprises.
    The viewer will learn how to count occurrences of each item in an array.
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

    779 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

    14 Experts available now in Live!

    Get 1:1 Help Now