headers already sent in php

The thing is on my local server its working just fine. Its only when it is uploaded
that it becomes an issue.This is the error i am getting&*/
Warning: Cannot modify header information – headers already sent by (output started
at /home/primepai/public_html/admin/userValidate.php:6) in
/home/primepai/public_html/admin/userValidate.php on line 38

<?php ob_start();?>
<?php session_start();?>
<?php 
//include config.php to connect to the database
include("../config.php");?>
<?php
if(isset($_POST['login'])){
$username= $_POST['username'];
$password= $_POST['password'];

$username = mysqli_real_escape_string($mysqli, $username);
$password = mysqli_real_escape_string($mysqli, $password); 
    
$query = "SELECT * FROM users WHERE username = '$username'";
$select_query = mysqli_query($mysqli, $query);

if(!$select_query){
    die("QUERY FAILED". mysqli_error($mysqli));
}
    
while($row = mysqli_fetch_array($select_query)){
$db_fullname = $row['full_name'];
$db_username = $row['username']; 
$db_password = $row['password'];
$db_userid = $row['user_id']; 
$db_userimage = $row['picture'];
}    
if ($username === $db_username && $password === $db_password){
$_SESSION['username'] = $db_username;
$_SESSION['full_name'] = $db_fullname;
$_SESSION['password'] = $db_password;
$_SESSION['user_id'] = $db_userid;
$_SESSION['picture'] = $db_userimage;
header("Location: dashboard.php");
die();
exit();
} else {
header("Location: index.php");
}  
}?>