2017-07-30 154 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代碼。 –