0

Im in a web development class and in this class our teacher had us download a verison of LAMP to run in Oracle VM Virtual Machine I'm 99% sure I've ran thru all of the applications that we were to download however when I try to run php in a HTML file it never works. This is my code:

<!DOCTYPE html>
<html>
<head>
<title>\</title>
</head>
<body>
<?php echo "dhlfdjsdlfjskd"; ?>
</body>
</html>

php version

I'm just not sure why this will not work. Even in the browser's inspector I am to see the php code which from my understanding I should not be able to do. If anyone has any suggestions I am grateful for those.

Álvaro González
  • 142,137
  • 41
  • 261
  • 360
Maya
  • 3
  • 2
  • Change your file extension to `.php` – Lessmore Dec 06 '20 at 00:57
  • Thank you, sweet amazing human being you're so awasome thank you – Maya Dec 06 '20 at 01:08
  • LAMP is a generic term, not a specific program. You'd need to share your Apache settings regarding PHP. I can barely read your screenshot —in Linux you can select text by just selecting it with the left mouse button and paste it with the middle button— but it seems to be the command-line interface, which doesn't use Apache at all. – Álvaro González Dec 07 '20 at 14:09

1 Answers1

-1

Because, php working on CLI (command line interface) your screenshot. We need to tell the server how to handle PHP files. We have to define them in the server config file. (Apache, Nginx etc.)

Check the answers given below.

Apache: https://stackoverflow.com/a/5121589/1101038

Nginx : https://stackoverflow.com/a/37305770/1101038

ahmeti
  • 464
  • 5
  • 12