I am a newbie and have never used PHP before. I want to execute PHP script from an HTML file on Linux. What do I need to do?
This is the content of my HTML file:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<HTML>
<HEAD>
<TITLE>Testing Weather Data</TITLE>
</HEAD>
<BODY>
<div id="weather">
<p>Weather Information
<?php include "/home/tahoang/Desktop/weatherData.php"; ?>
</div>
</BODY>
</HTML>
What output do you receive? Does it just show the PHP code?
I assume that’s the case.
For a test, change the extension on the file to
.phpand run it again. Does it work now?If so, you will need to associate PHP with
.htmland.htmfiles on your server.EDIT
This is the line you want to add to your Apache config: