Reputation: 391
I had write a simple html code and save it as testing.html in eclipse. Below are the code:
<html>
<body>
<?php
function helo()
{
echo "hello";
}
echo "say ";
helo();
?>
</body>
</html>
When I run via apache Tomcat, it did not show any things in my browser. I had tried to write a simple html code (without php code inside the html code) and it can run via apache Tomcat. May I know why this happen? Is it something wrong with my code? Or some thing go wrong when I set up in eclipse?
Upvotes: 0
Views: 1637
Reputation: 27802
Your web server doesn't run the PHP preprocessor on your html document.
To fix this, you need to rename your testing.html
file to testing.php
.
Upvotes: 1
Reputation: 24655
PHP generally isn't parsed in html documents... try changing the file to testing.php and see what you get.
If that still doesn't work then it's possible php isn't installed or correctly configured on your hosting environment.
Upvotes: 3
Reputation: 51
Your server reads the ".html" extension and interprets the file as an html file. Therefore, you cannot interweave php in it. However, if you change the filename to testing.php, the tomcat server will interpret the php, and you will get your desired result.
Upvotes: 0