PHP文件下载,而不是在ubuntu中的examplep中执行


PHP file downloading rather than executing in my xampp in ubuntu

我正试图在本地主机上运行我的文件,但当我执行提交按钮时,它会弹出下载一个HTML链接到的PHP文件。它在mac上运行良好,但在UBUNTU中运行不好。请告诉我最好的解决方案。

<HTML>
<head>
<title>MOVIE DATABASE SYSTEM</title>
<link  href="style.css" type="text/css" rel="stylesheet"/>
</head>
<body>
<div class="content">
<center>Movie Database System</center>
</div>
<form method="POST" action="add_movie.php" >
Movie Number:<br>
<input TYPE="TEXT" NAME="Movie_id" required><br><br>
Title:<br>
<input TYPE="TEXT" NAME="Title" required><br><br>
Year:<br>
<input TYPE="TEXT" NAME="Year" required><br><br>
Plot:<br>
<input TYPE="TEXT" NAME="Plot" required><br><br>
Movie Length:<br>
<input TYPE="TEXT" NAME="Length" required><br><br>
<a href="#"><button>SUBMIT</button>
<button>CANCEL</button></a>
</form>
<a href="admin.html"><button>ADMIN HOME</button></a>
</body></html>

您将直接在web浏览器中以文件的形式打开html文件。相反,您需要通过web服务器访问它,方法是:http://localhost或http://127.0.0.1(取决于您的配置设置方式)。我还假设你有一台网络服务器在那台计算机上运行。

您的默认web目录可能位于/var/www或/var/www/html中。

如果你还没有安装网络服务器,你可以像这样安装apache:

sudo apt-get install apache2