//you made the connection $conn = new mysqli($servername, $username, $password, $dbname); //correct way to logout is to simply close the connection $conn->close();