2

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>         
            ";  
    }
?>
0

3 Answers 3

7

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

Sign up to request clarification or add additional context in comments.

3 Comments

As far as I see from my ftp client - no there is no such
What does <?php $message = ( file_exists('/var/php_sessions/') ) ? 'found php_sessions directory' : 'could not find php_sessions directory'; echo $message; ?> report?
Would have appreciated some feedback on what you did to solve it.
3

phpGrid requies session to work.

First of all, if you have access to php.ini, check if path in session.save_path is valid and writable. In Linux, by default, the path is /var/php_sessions/.

Some web hosting services such as iPage, disallows shared user session folder for security reasons. Users MUST create and maintain their own session folder.

http://www.ipage.com/knowledgebase/beta/article.bml?ArticleID=1290&type=How%20To#Nugget_1374

If you don’t want to deal with all those and prefer more loose security hosting, we recommend bluehost or stablehost.

1 Comment

For a MedaWiki deployment on my site in iPage I was having tons of warnings in the logs.. thanks for pointing this out, redirected to use /cgi-bin/tmp via the user's custom php.ini - it took a few minutes for the file update to get recognized, but now it works.
0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.