2017-07-30 157 views
0

由于某些原因,我的HTML文件中嵌入的PHP脚本无法在我的计算机上运行。php将无法使用xampp运行

因此,我已经在Linux上安装了XAMPP,使用此常见问题解答中第一个问题的说明:https://www.apachefriends.org/faq_linux.html(指向外部网站的链接)。链接到外部网站。

我已经设置它使用的命令中:/ opt/LAMPP/LAMPP开始

和我得到的消息发回:启动XAMPP的Linux 7.1.7-0 ... XAMPP:启动Apache .. 。好。 XAMPP:启动MySQL ...好的。 XAMPP:启动ProFTPD ...好的。

我不知道为什么我得到有关启动PRoFTPD而不是PHP的消息,我认为这可能是其中的一部分。

以下是我的HTML文件:

<!DOCTYPE html> 
<html lang="en-US"> 
<head> 
<meta charset = "utf-8"> 
<title>CS80 Final</title> 
<link rel = "stylesheet" type ="text/css" href = "final.css" /> 
<!-- <script type = "text/javascript"> 
</script> --> 
</head> 
<body> 
<h1 id ="title"> <bold> Garden Exchange </bold> </h1><!-- Title of the page--> 
<section> <!-- Section regarding making a selection --> 
What type of plant are you looking for? 
<input type = "text" id = "plant"/> 
<input type = "button" id = "plantbutton" value = "Find plant"/><br> 
<br/> <br/> 
Looking to list a plant instead? 
<input type = "button" id = "input button" value = "List a plant"/> 
</section> 
<?php 
$nam = array("Bob", "Willow", "sagment lamp"); 
if (preg_match("/low/",$nam)) 
{ 
print ("<p> 'low' was found </p>"); 
} 
?> 
<section id ="listings" style: hidden="hidden"> 
</section> 
<section id = "listing" style: hidden = "hidden"> 
</section> 
</body> 
</html> 

我感谢所有帮助我能!

+0

您有多个明显的语法错误,但没有看到它们,因为错误报告已关闭。打开它,你会发现什么是错的。 –

+0

如何打开它? –

+0

看问题顶部的链接 –

回答

0

如果它是html文件,则将文件扩展名更改为.php。

+0

如果它是一个html文件,那么为什么我应该将其更改为一个php文件? –

+0

因为php脚本不能在html文件中运行。该文件的扩展名应该是.php来执行php代码。 –