I am using localhost for development and have created an area of my site where I use sessions to help inforce user login. My pages start like this:
<?php
// enforce login
session_start();
if (empty($_SESSION["userID"]
)) {
$where = strtolower("
http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']);
setcookie("backto", $where);
header("Location:
http://www.somewhere.com/contributors/login.php");
}
// rest of page...
I get the following errors:
Warning: session_start() [function.session-start]: open(/tmp\sess_52a808fa77f
404fa43c51
174ea1b5bb
c, O_RDWR) failed: No such file or directory (2) in f:\apache\Apache\htdocs\ss
p\contribu
tors\index
.php on line 3
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at f:\apache\Apache\htdocs\ss
p\contribu
tors\index
.php:3) in f:\apache\Apache\htdocs\ss
p\contribu
tors\index
.php on line 3
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at f:\apache\Apache\htdocs\ss
p\contribu
tors\index
.php:3) in f:\apache\Apache\htdocs\ss
p\contribu
tors\index
.php on line 3
Warning: Cannot modify header information - headers already sent by (output started at f:\apache\Apache\htdocs\ss
p\contribu
tors\index
.php:3) in f:\apache\Apache\htdocs\ss
p\contribu
tors\index
.php on line 6
Warning: Cannot modify header information - headers already sent by (output started at f:\apache\Apache\htdocs\ss
p\contribu
tors\index
.php:3) in f:\apache\Apache\htdocs\ss
p\contribu
tors\index
.php on line 7
1064: You have an error in your SQL syntax near '' at line 1
My php.ini files shows:
[Session]
; Handler used to store/retrieve data.
session.save_handler = files
; Argument passed to save_handler.
***more documentation...***
session.save_path = "F:\php\sessiondata" ; argument passed to save_handler
; Whether to use cookies.
session.use_cookies = 1
; This option enables administrators to make their users invulnerable to
; attacks which involve passing session ids in URLs; defaults to 0.
session.use_only_cookies = 1
; Name of the session (used as cookie name).
session.name = PHPSESSID
; Initialize session on request startup.
session.auto_start = 0
; Lifetime in seconds of cookie or, if 0, until browser is restarted.
session.cookie_lifetime = 0
; The path for which the cookie is valid.
session.cookie_path = /
; The domain for which the cookie is valid.
session.cookie_domain =
The sessiondata directory does exist, and it has three session cookies already, so I know it can't be that PHP cannot write to that file. On my live site the same files work perfectly. (I have cross-referenced the results of phpinfo() locally and remotely and can find no differences that would cause a problem.)
Can anyone tell me what the problem is here and how to fix it? It would be a tremendous help!
Start Free Trial