SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    Resident Boozehound simontheak's Avatar
    Join Date
    Jun 2003
    Location
    _root.europe.uk.london
    Posts
    965
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problem with session_start()

    Ok, I'm in the middle of writing my first script using sessions. Here's what I've got so far:
    PHP Code:
    <?php
    $user 
    $_POST['username'];
    $pass $_POST['password']; 


    $db mysql_connect("localhost") or die ("Couldn't connect to database"); 
    mysql_select_db("test"$db) or die ("Couldn't select the database."); 
    $result mysql_query("select * from details where username='$user' AND password='$pass'"$db); 

    $rowCheck mysql_num_rows($result);

    if(
    $rowCheck 0){ 
    while(
    $row mysql_fetch_array($result)){ 

      
    //start the session and register a variable 

      
    session_start(); 
      
      
    //successful login code will go here... 
      
    echo 'Success!'

       } 
    }

    ?>
    However, when I run the script I get all kinds of error messages like:

    Warning: session_start(): open(/tmp\sess_c7f958a2fd528361fe4cbf743be3dc4f, O_RDWR) failed: No such file or directory (2) in c:\apache\apache\htdocs\sessions.php on line 16

    Warning: session_start(): Cannot send session cookie - headers already sent by (output started at c:\apache\apache\htdocs\sessions.php:16) in c:\apache\apache\htdocs\sessions.php on line 16

    Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at c:\apache\apache\htdocs\sessions.php:16) in c:\apache\apache\htdocs\sessions.php on line 16
    They all seem to be do with the header information. Can anyone give me any hints on what I might be doing wrong?

    Thanks alot

  2. #2

    Join Date
    Oct 2003
    Location
    €uroLand
    Posts
    1,340
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Warning: session_start(): open(/tmp\sess_c7f958a2fd528361fe4cbf743be3dc4f, O_RDWR) failed: No such file or directory (2) in c:\apache\apache\htdocs\sessions.php on line 16
    PHP cant access the /tmp directory for some reason, which it need to save the session information. Contact your server administrator.

  3. #3
    Resident Boozehound simontheak's Avatar
    Join Date
    Jun 2003
    Location
    _root.europe.uk.london
    Posts
    965
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi drzoid - thanks for the reply,

    So does that mean that I need to put a tmp directory inside the htdocs directory?

  4. #4

    Join Date
    Oct 2003
    Location
    €uroLand
    Posts
    1,340
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, its a PHP configuration (respectively directory permission) related matter.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •