Aug 25

my session test code:

<html>
<head>
<title>PHP SESSION TEST CODE</title>
</head>
<body>
<?
session_start();
session_register("MVAR");
$MVAR="hello world";
echo "The content of sess variable is $MVAR";
?>
<a href="call_session.php">Next page</a>
</body>
</html>

Error Tips

Warning: session_start(): Cannot send session cookie – headers already sent by (output started at d:\www\session.php:7) in d:\www\session.php on line 8

Warning: session_start(): Cannot send session cache limiter – headers already sent (output started at d:\www\session.php:7) in d:\www\session.php on line 8
The content of sess variable is hello worldNext page

Solution:

1.Modify your php.ini file. Find the output_buffering variable and varlue is on,as output_buffering = On.

2.Find your session save path, you can find it from php.ini of session.save_path = "c:\tmp"
   Please ensure php can write the “c:\tmp” directory.

Tagged with:
preload preload preload