0

Here I attached my code

<?php
session_start();
global $wpdb;
$msg2 = " ";
$msg1 = " ";
if(isset($_SESSION['msg2'])){
$msg2 = $_SESSION['msg2'];
echo "<script> alert( '  $msg2  ' ); </script> "; 
}
?>

I got below error

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /homepages/2/d213994292/htdocs/pub_site/wordpress/wp-content/themes/wp-visual106/header.php:3) in /homepages/2/d213994292/htdocs/pub_site/wordpress/wp-content/plugins/php-code-widget/execphp.php(27) : eval()'d code on line 2

How to solve these.please anyone help me..

Lorenzo Belfanti
  • 1,205
  • 3
  • 25
  • 51

1 Answers1

0

The error message is specifically telling you that something on line 3 of the script generated output prior to the session_start() call.

Either there is something before the opening tag (a space, a newline, a unicode BOM character), or the only other thing I can think of would be if your PHP configuration has an auto_prepend_file specified and that file is generating output, although in that case I think the error message would point to that file instead (though I'm not 100% sure about that).

AddWeb Solution Pvt Ltd
  • 21,025
  • 5
  • 26
  • 57