Session_start(): Cannot send session cookie - headers already sent

  • updated
  • Answered

I don't know what cause this, but I have made an admin panel that controlle my website everything work in the local host but when I have upload the website to inmotionhosting cpanel this error show in my admin panel

you can see the page here

this is the php codes

include 'inc/db.php';


if(!empty($_POST['user_name']) && !empty($_POST['password'])){

$get_user_name = mysqli_real_escape_string($conn,$_POST['user_name']);

$pass = md5($_POST['password']);

$get_password = mysqli_real_escape_string($conn,$pass);

$sql = "SELECT * FROM users WHERE user_email = '$get_user_name' AND user_password = '$get_password'";

if($result = mysqli_query($conn,$sql)){

while($rows = mysqli_fetch_assoc($result)){

if(mysqli_num_rows($result) == 1){

$_SESSION['user'] = $get_user_name;

$_SESSION['password'] = $get_password;


} else {




}else {



} else {



}else {


Hello, Thank you for your question about the PHP "headers already sent" error. I advise checking the PHP configuration in your local host to see if it matches the configuration on the InMotion server. Best, Christopher M.