Hi,

I'm running PHP 4 on a windows server where even IIS is running. This is my in-house setup with MySQL and MS SQL running on the same server.

Problem: The session variables used in my code are not carried to all the pages. There is a login page in my site which checks for the username and password and redirects to a welcome page if authenticated.
In the login page I am setting up the session variable and assigning a value and when I try to check that in the redirected welcome page, it is null. But, the same code runs perfectly using PHP 4 on Linux server. What could be the problem when running on windows server??? I have also upgraded my browser to the latest version (IE 6.0 service pack 1).

Code:login page
session_start();
$row=mysql_fetch_array($result);
$_SESSION["login"]=$row[app_no];
header("Location: welcome.php");

Code: welcome page
session_start();
if($_SESSION["login"]==""){
header("Location: login.php");
}

can any one help me in solving this issue??

    check the session.save_path section in the php.ini file...ensure it is set to windows paths c:\temp not unix paths /tmp

    hth

      hi bastien,
      thanks for your reply. but still i didn't get the solution as the session.save in php.ini file as follows and it still doesn't work.

      session.save_path = C:\PHP\sessiondata

      any other solution ??????🙁

        Helllo
        I am also facing the same prob. i had designed an application and it was working fine when path in php.ini was c:\php\sesiondata but my isp has the path ".\" in their php.ini file,so i had made the respective change in my php.ini now session are creating in the root of the application ,and i am not able to fetch session variable,so if you can think in this way and find the solution then do reply at opensource@softsolvers.com

          Originally posted by sweetsri24
          hi bastien,
          thanks for your reply. but still i didn't get the solution as the session.save in php.ini file as follows and it still doesn't work.

          session.save_path = C:\PHP\sessiondata

          any other solution ??????🙁

          s/b session.save_path = "C:\PHP\sessiondata\"

          Don't forget the quotes and trailing slash to indicate a folder

          Originally posted by softsolvers

          Helllo
          I am also facing the same prob. i had designed an application and it was working fine when path in php.ini was c:\php\sesiondata but my isp has the path ".\" in their php.ini file,so i had made the respective change in my php.ini now session are creating in the root of the application ,and i am not able to fetch session variable,so if you can think in this way and find the solution then do reply at opensource@softsolvers.com

          you just need to change the path to match the new set-up and add the sessiondata folder to the filesystem.

          For unix:
          session.save_path = "/tmp/sessiondata/"

          For Windows:
          session.save_path = ".\sessiondata\"

            Ok, every I have done everything in the thread, but.
            I'm developing a page with Apache 1.3.X and php-4.3.4,
            under Windows 2000 professional.

            In my php.ini file I had set the session_path="C:\php\sessions"
            when I start the session with:

            <?php
            session_start();
            $_SESSION['myvar]='Some string';
            echo '<a href="test.php">Test</a>';
            ?>

            This creates a file with the name:
            sess_56#######.....etc.
            When I edit it is says:
            myvar|s:11:"Some string"
            However, when I hit the Test link on my page
            the value does not exists in the new page, and
            it creates me a new session file in the session folder.

            The code for the test.php file is:
            <?php
            session_start();
            echo $_SESSION['myvar'];
            ?>

            Any help will be appreciated.

            MAGO

              still missing the closing slash on the ini file

              session_path="C:\php\sessions\" <--need the closing slash

                Hi,
                I have changed
                session.save_path = C:\PHP\sessiondata
                to
                session.save_path = "C:\PHP\sessiondata\" but still the problem persists.

                I have noticed a new thing in the process: my system is connected to a LAN and if the application is accessed through some other system using http then the session variables work perfectly. I need not make any changes to the ini file in this case.

                The other system which is accessing my site/application in the LAN is running windows XP. But, the problem on my system is not yet resolved.

                Help appretiated.

                  why u guys are not thinking about dynamic path,if v will be able to make path dynamically i.e. on the php page then the solution will be forever,but my prob is that while i am using session_save_path in my code it works on local host bcoz i have the rights ,but on the isp i donot have such rights so if u can then plz. help me

                    u can use the dynamic path in the php.pni i.e. (.) for session.save_path and then store the session accordingly where .\ means that u r on the root from where u r running ur page

                      and if you don't want it in the root?

                        Write a Reply...