tags:

views:

57

answers:

2

Hello!

Im currently trying to move my site from localhost on my machine to my web server. And there is one problem.

Everything works fine, except login form for administration.

At first I thought it was not-saving-as-utf-8-without-BOM problem, but error logs show some strange problem which I never had before. As far as I understand, the problem is about saving session data on server, see error log below.

PHP Warning:  session_start() [<a href='function.session-start'>function.session-start</a>]: open(/var/php_sessions/sess_cd9931f63118e645ca5d3704fecf86c6, O_RDWR) failed: No such file or directory (2) in /hermes/bosweb/web273/b2738/ipg.mydomaincom/admin/login.php on line 2 
PHP Warning:  Unknown: open(/var/php_sessions/sess_cd9931f63118e645ca5d3704fecf86c6, O_RDWR) failed: No such file or directory (2) in Unknown on line 0 
PHP Warning:  Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/php_sessions) in Unknown on line 0 
PHP Warning:  session_start() [<a href='function.session-start'>function.session-start</a>]: open(/var/php_sessions/sess_cd9931f63118e645ca5d3704fecf86c6, O_RDWR) failed: No such file or directory (2) in /hermes/bosweb/web273/b2738/ipg.mydomaincom/admin/include/header.php on line 2 
PHP Warning:  Unknown: open(/var/php_sessions/sess_cd9931f63118e645ca5d3704fecf86c6, O_RDWR) failed: No such file or directory (2) in Unknown on line 0 
PHP Warning:  Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/php_sessions) in Unknown on line 0

Here is the code I use for login.php document:

<?php
    session_start ();
    require_once 'config/config.php';
    $auth = "SELECT username, password FROM admin";
  $dbi = mysql_query($auth, $connection);
  $row = mysql_fetch_array($dbi);

    if($_POST["username"] == $row['username'] && MD5($_POST["password"]) == $row['password'])

    {
        $_SESSION["Login"] = "true";
        header ("Location: index.php");
    }
    else 
        {
            $_SESSION["Login"] = "false";
            //error msg
            echo "<html>
            <head><title>Failed Login Attempt</title></head>
            <body>
            Ops! Unlucky guess, try again!  
            <a href='index.php'>Go Back</a>
            </body>
            </html>         
            ";  
    }
?>
+3  A: 

first step, check that the directory /var/php_sessions/ exists and is writable by your web server.

Dave
As far as I see from my ftp client - no there is no such
Chris
What does `<?php $message = ( file_exists('/var/php_sessions/') ) ? 'found php_sessions directory' : 'could not find php_sessions directory'; echo $message; ?>` report?
danlefree
solved this problem with the help of hosting support.
Chris
A: 

maybe you should create the directory first. It seems that the directory in your config/config.php doesn't exists.

T_t