I have created a simple web server using LAMP on Ubuntu 18.04, with PHP7 installed. The web server is only accessible by its local IP address, and can host web pages with HTML5 and CSS3, but I'm trying to integrate PHP into web pages as a stepping stone towards AJAX communication between the HTML (using JavaScript) and a back-end PHP file on the web server.
I keep getting the problem of the website body showing as:
Hello World!
";?>
with the PHP code being:
<html>
<head>
<title>My first PHP Website</title>
</head>
<body>
<?php
echo "<p>Hello World!</p>";
?>
</body>
</html>
Does anyone know why this occurs as i would have expected the ";?> to not be displayed.
I have attached images of the code on the server (a HTML file) and the web page as seen on another computer via http://local_ip/directory/file_name.html on Google Chrome, but I also checked it on Internet Explorer and Microsoft Edge, meaning it is not just a browser issue so more likely to be a server side / code syntax issue.
Thanks in advance