My PHP code is just a comment in my html

Sorry guys, this is probably pretty simple, but I'm too late. I have a basic html page with some javascript on it, and when I try to put any php in the body, it reads it as a comment.

    <html>
    <head>
    <link rel="stylesheet" href="style.css" type="text/css" media="screen">
    <script type="text/javascript" src="jquery-1.3.2.min.js"></script> 
    <script type="text/javascript" src="jquery.tablesorter.min.js"></script> 
    <script type="text/javascript" src="jquery.tablesorter.pager.js"></script> 
     <script type="text/javascript">
     $(function() {
      $("table")
       .tablesorter({widthFixed: true, widgets: ['zebra']})
       .tablesorterPager({container: $("#pager")});
     });
     </script>
    </head>
    <body>
    <div id="main">
    <h1>Demo</h1>

    php in here

    <?php  
    echo "test php";
    ?>

...
main code for a table here
</div>
</body>
</html>
+2
source share
1 answer

It looks like you either do not have PHP installed, or you are not using the file extension that calls the PHP engine - is this your file with a name Blah.php?

Some things to check:

  • You are serving a file from a web server (not locally)
  • PHP is installed on the server
  • PHP is configured to handle the type of file you use (usually .php)
  • <?php phpinfo(); ?> PHP.
  • , PHP /
+9

All Articles