第一个echo函数后PHP代码无法正常工作

I've been trying to create a web application that functions like a library system, and I am currently working on building the table that will display all books in the system. However, after I close the first echo statement to start building the table in HTML, the app seems to just stop seeing it as code and prints the rest of the PHP code to the screen.

Here is the code in question:

<?php
        $db = mysqli_connect('34.224.99.227','root','opendoor','library')
            or die ('Could not connect to database');

        $result = mysqli_query($db,'SELECT * FROM book');

        echo '<table id="table_id" class="display">
              <thead>
                <tr>
                    <th>ISBN</th>
                    <th>Title</th>
                    <th>Author</th>
                    <th>Description</th>
                    <th>Status</th>
                </tr>
               </thead>
               <tbody>';

        while($row = mysqli_fetch_array($result)) {
            echo '<tr>';
            echo '<td>' . $row['isbn'] . '</td>';
            echo '<td>' . $row['title'] . '</td>';
            echo '<td>' . $row['author'] . '</td>';
            echo '<td>' . $row['description'] . '</td>';
            echo '<td>' . $row['status'] . '</td>';
            echo '</tr>';
        }

        echo '</tbody></table>';

        mysqli_close($db);
    ?>

And here is the corresponding web page output:

ISBN Title Author Description Status '; while($row = mysqli_fetch_array($result)) { echo ''; echo '' . $row['isbn'] . ''; echo '' . $row['title'] . ''; echo '' . $row['author'] . ''; echo '' . $row['description'] . ''; echo '' . $row['status'] . ''; echo ''; } echo ''; mysqli_close($db); ?>

I'm obviously not too well-versed in PHP, so I'm at a loss as to what the problem could be.

After playing around with the settings of my LAMP stack, I realized that I had apparently configured it with PHP 5 in mind, while I had downloaded PHP 7. Once I fixed the discrepancy, everything worked as intended. Thanks for help nonetheless.