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

Avatar
  • 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 http://hiluxasia.com/admin123/sign-in.php


this is the php codes


include 'inc/db.php';


if(isset($_POST['submit_signin'])){


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;


header('Location:index.php');


} else {


header('Location:sign-in.php?login_error=wrong');


}


}



}else {


header('Location:sign-in.php?login_error=query_error');


}


} else {


header('Location:sign-in.php?login_error=empty');


}


}else {


}

Avatar
IMH Support Agent 5
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.