how can i execute php code after HTML code

one text

i know it's normal for php to execute after HTML but i have a site hosted in both infinityfree.net and SiteGround.com the site is working fine on infinityfree.net but it's not working on siteground.com it turns out that siteground doesn't execute php unless it comes on the top of the page before the HTML code

i don't want to edit my code so if there any trick that i could do i will appreciate the help

here is a sample of the code

    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="css/doc.css">
        <link rel="stylesheet" type="text/css" href="vendor/bootstrap/css/bootstrap.min.css">
<!--===============================================================================================-->
    <link rel="stylesheet" type="text/css" href="fonts/font-awesome-4.7.0/css/font-awesome.min.css">
<!--===============================================================================================-->
    <link rel="stylesheet" type="text/css" href="vendor/animate/animate.css">
<!--===============================================================================================-->
    <link rel="stylesheet" type="text/css" href="vendor/css-hamburgers/hamburgers.min.css">
<!--===============================================================================================-->
    <link rel="stylesheet" type="text/css" href="vendor/select2/select2.min.css">
<!--===============================================================================================-->
    <link rel="stylesheet" type="text/css" href="css/util.css">
    <link rel="stylesheet" type="text/css" href="css/main.css">
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <link rel="stylesheet" href="css/font-awesome.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<?php
session_start();
 
if(isset($_SESSION["loggedin"]) && $_SESSION["loggedin"] === true){
    header("location: welcome.php");
    exit;
}
 
require_once "config.php";
 
$username = $password = "";
$username_err = $password_err = $login_err = "";
 
if($_SERVER["REQUEST_METHOD"] == "POST"){
 
    if(empty(trim($_POST["username"]))){
        $username_err = "?�?�?�?�?�?? ?�???�?�?� ?�???� ?�?�?�?????�???�.";
    } else{
        $username = trim($_POST["username"]);
    }
    
    if(empty(trim($_POST["password"]))){
        $password_err = "?�?�?�?�?�?? ?�???�?�?� ???�?�?� ?�?�?�?�?�?�.";
    } else{
        $password = trim($_POST["password"]);
    }
    
    if(empty($username_err) && empty($password_err)){
        $sql = "SELECT id, username, password, random FROM users WHERE username = ?";
        
        if($stmt = mysqli_prepare($link, $sql)){
            mysqli_stmt_bind_param($stmt, "s", $param_username);
            
            $param_username = $username;
            
            if(mysqli_stmt_execute($stmt)){
                mysqli_stmt_store_result($stmt);
                
                if(mysqli_stmt_num_rows($stmt) == 1){                    
                    mysqli_stmt_bind_result($stmt, $id, $username, $hashed_password, $rand);
                    if(mysqli_stmt_fetch($stmt)){
                        if(password_verify($password, $hashed_password)){
                            session_start();
                            
                            $_SESSION["loggedin"] = true;
                            $_SESSION["id"] = $id;
                            $_SESSION["random"] = $rand;
                            $_SESSION["username"] = $username;                            
                            
                            header("location: welcome.php");
                        } else{
                            $login_err = "?�???� ?�?�?�?????�???� ?�?� ???�?�?� ?�?�?�?�?�?� ?�?�??.";
                        }
                    }
                } else{
                    $login_err = "?�???� ?�?�?�?????�???� ?�?� ???�?�?� ?�?�?�?�?�?� ?�?�??.";
                }
            } else{
                echo "???�?�?�?�! ?�???� ?�?�?? ?�?�?�?� ?�?�?�?�?�?�.";
            }

            mysqli_stmt_close($stmt);
        }
    }
    
    mysqli_close($link);
}
?>
 


</head>    
<body dir="rtl" bgcolor="#073b4c" text="#f1f1f1">
<?php include 'header.html';?>
<style>
.header{
    position:absolute;
}
        .navbar{
            display:none;
        }

</style>
<div class="intro1">     ???�?� ???? ?�?�?�?? <b>?�?????? ?????�??</b> ?�?�?� ???�???�?�???� ?�?�?�?�???� ?�?�?�?�?� ???? ?�?�???�?? ?�?� ???�?�?�?� ???�???�?�???? ???�?? 
<br>     ???�?? ?�???�?�???� ?�?�?�?�???� ?�?�?�?�?� ???? ???????�?� ?????� ?�?�?�???�?�?� ?�???�???�?�???? ?�?� ?�?�???�?�?� ?�?�?�?�?�???� ???�?�?� ???????�?????? ???? ???�?�???� ?�?�???� ?�?�?�?�???�</div>
 <div class = "vertical"></div>
<div class="text12"><br>?�???? ?�?????? ?�???�????
<br />
???�???�?? ?�?�?�???�?????� ???�???�???? ???�?� ?�?�?????????�?? ?�?� ?�?�?????�???� ???? ?�?�?�?�?�??
</div><br /><br />
<br />
<br /><br />
<a href="register.php"><button class="button">?�?�?????�???�</button></a>

    <div class="wrapper">
<div class="wrap">
        <center><font size="+3">?????�???� ?�?�???�?�?�</font></center>
        <br />
        <p class="p">?�???�?� ?�???� ?�?�?�?????�???� ?�?�?�?�?� ???? ?�???�?�?� ?�?�?�?�?�?� ?�?????�???� ?�?�???�?�?�.</p>

        <?php 
        if(!empty($login_err)){
            echo '<div class="alert alert-danger">' . $login_err . '</div>';
        }        
        ?>
        <form class="form" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="post">
            <div class="form-group">
                <label>?�???� ?�?�?�?????�???�</label>
                <input type="text" name="username" class="form-control <?php echo (!empty($username_err)) ? 'is-invalid' : ''; ?> f" value="<?php echo $username; ?>">
                <span class="invalid-feedback"><?php echo $username_err; ?></span>
            </div>    
            <div class="form-group">
                <label>???�?�?� ?�?�?�?�?�?�</label>
                <input type="password" name="password" class="form-control <?php echo (!empty($password_err)) ? 'is-invalid' : ''; ?>f">
                <span class="invalid-feedback"><?php echo $password_err; ?></span>
            </div>
            <div class="form-group">
                <input type="submit" class="btn btn-primary f1" value="?????�???� ?�?�???�?�?�">
            </div></form></div></div>
<br><br>
</div></body>

Source