PHP session problem

PHP session problem

Page 1 of 1

5 Replies - 1449 Views - Last Post: 30 December 2007 - 03:26 PM Rate Topic: -----

#1 young2daniel  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 42
  • Joined: 29-December 07

PHP session problem

Post icon  Posted 29 December 2007 - 02:58 AM

I can't start a session in PHP.
It gives me an error about the Save_handler tmp directory.
Please tell me what to do.

Thanks.
Is This A Good Question/Topic? 0
  • +

Replies To: PHP session problem

#2 young2daniel  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 42
  • Joined: 29-December 07

Re: PHP session problem

Posted 29 December 2007 - 04:00 PM

I created a login form recently from a tutorial i got from the net and after running it in my testing server i encountered this error:

Warning: open(/tmp\sess_abce2b6c6aa135f95063f8710f973fc9, O_RDWR) failed: No such file or directory (2) in c:\phpdev5\www\register\login.php on line 15

Warning: open(/tmp\sess_abce2b6c6aa135f95063f8710f973fc9, O_RDWR) failed: No such file or directory (2) in Unknown on line 0

Warning: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0

I tried changing the session.save_path from /tmp to a directory that exists in my hard disk, but still no luck.
What do i do? Somebody please help me.

Thanks.


<?php
//Database Information

$dbhost = "localhost";
$dbname = "jukel";
$dbuser = "root";
$dbpass = "";

//Connect to database

mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());
mysql_select_db($dbname) or die(mysql_error());


session_start();

$username = $_POST['username'];
$password = md5($_POST['password']);

$query = "select * from users where username='$username' and password='$password'";

$result = mysql_query($query);


if (mysql_num_rows($result) != 1) {
$error = "Bad Login";
	include "login.html";

} else {
	$_SESSION['username'] = "$username";
	include "memberspage.php";
}

?>

Attached File(s)

  • Attached File  login.php (675bytes)
    Number of downloads: 65

Was This Post Helpful? 0
  • +
  • -

#3 snoj  Icon User is offline

  • Married Life
  • member icon

Reputation: 93
  • View blog
  • Posts: 3,583
  • Joined: 31-March 03

Re: PHP session problem

Posted 29 December 2007 - 04:16 PM

Do not double post. Topics merged.

It appears that whatever user apache/php is running under does not have permissions to write to the /tmp folder or access said files.
Was This Post Helpful? 0
  • +
  • -

#4 ahmad_511  Icon User is offline

  • MSX
  • member icon

Reputation: 131
  • View blog
  • Posts: 722
  • Joined: 28-April 07

Re: PHP session problem

Posted 30 December 2007 - 04:16 AM

Hi there.
If it wasn't permissions.... continue reading.

Please make sure that the Session-save directory is exists.

1- Go to your php installation folder.
2- Open the file php.ini with your favorite text editor.
3- search for (session.save_path)
4- Check if the path is pointing to an existing directory, if not change it to somewhere you want to save Sessions in.
5- Restart your localhost
Was This Post Helpful? 0
  • +
  • -

#5 young2daniel  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 42
  • Joined: 29-December 07

Re: PHP session problem

Posted 30 December 2007 - 09:05 AM

View Postahmad_511, on 30 Dec, 2007 - 04:16 AM, said:

Hi there.
If it wasn't permissions.... continue reading.

Please make sure that the Session-save directory is exists.

1- Go to your php installation folder.
2- Open the file php.ini with your favorite text editor.
3- search for (session.save_path)
4- Check if the path is pointing to an existing directory, if not change it to somewhere you want to save Sessions in.
5- Restart your localhost



I did that b4 posting but the error message was still displaying.
Please any other suggestion?

Thanks.
Was This Post Helpful? 0
  • +
  • -

#6 ahmad_511  Icon User is offline

  • MSX
  • member icon

Reputation: 131
  • View blog
  • Posts: 722
  • Joined: 28-April 07

Re: PHP session problem

Posted 30 December 2007 - 03:26 PM

Could you zip the php.ini you're already using and post it here,so maybe we can test it on our machines and then we can figuer out what causes the problem.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1