fabs Posted January 7, 2010 Share Posted January 7, 2010 i made a session script like this <?php session_start(); ?> <html> <head> <title>Listing 20.1 Starting or resuming a session</title> </head> <body> <?phpprint "<p>Welcome, your session ID is ".session_id()."</p>\n\n"; ?> </body> </html>but it result an error like thisWarning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /var/www/w3school_trying/session.php:2) in /var/www/w3school_trying/session.php on line 3Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /var/www/w3school_trying/session.php:2) in /var/www/w3school_trying/session.php on line 3Welcome, your session ID is 9e755313bf0afe34f3ca33c496942fcehow to solve this problem???? Link to comment Share on other sites More sharing options...
Redroest Posted January 7, 2010 Share Posted January 7, 2010 First of all make sure that NO other outputs are made before executing session_start. What do you get if you leave the file empty exept: <?phpsession_start();echo session_id();?> Link to comment Share on other sites More sharing options...
fabs Posted January 7, 2010 Author Share Posted January 7, 2010 First of all make sure that NO other outputs are made before executing session_start. What do you get if you leave the file empty exept:<?phpsession_start();echo session_id();?> i have made the script above andit still gotan error Link to comment Share on other sites More sharing options...
Synook Posted January 8, 2010 Share Posted January 8, 2010 Do you have anything above that code? Are you trying to include that code, or do you have some prefixes* defined in Apache? If you view the resulting HTML code, what do you see?* can't remember the technical term Link to comment Share on other sites More sharing options...
justsomeguy Posted January 8, 2010 Share Posted January 8, 2010 This line tells you where the output is:Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /var/www/w3school_trying/session.php:2) in /var/www/w3school_trying/session.php on line 3 Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.