Session in PHP

Actually I want to create the session variable in PHP here is my script


<?
session_start();
session_register('session_variable');
$session_variable = $session_variable ? $session_variable + 1 : 20;
echo $session_variable;
?>

But it is not running properly and when I try to execute it ,It shows following page(ERROR)


Warning: Cannot send session cookie - headers already sent by (output started at d:\mith\php\session_v.php:3) in d:\mith\php\session_v.php on line 4

Warning: Cannot send session cache limiter - headers already sent (output started at d:\mith\php\session_v.php:3) in d:\mith\php\session_v.php on line 4

Warning: open(D:\mith\PHP\sessiondata\sess_ee992a9b15414092726e9e005d28699f, O_RDWR) failed: No such file or directory (2) in d:\mith\php\session_v.php on line 4

Warning: Undefined variable: session_variable in d:\mith\php\session_v.php on line 6
20
Warning: open(D:\mith\PHP\sessiondata\sess_ee992a9b15414092726e9e005d28699f, 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 (D:\mith\PHP\sessiondata) in Unknown on line 0<br



Please help me for solving this problem.

Thank you

 

 

 

 

Top