For some reason, the PHP I place in my index.php page is not working. When I inspect element, the PHP script, which is a simple include statement, is being read as an HTML comment. How do I fix this?
1 Answer
Two possible reasons. The first is that your web server is not configured to handle PHP.
Second, you may be using short open tags (<?) and those may be disabled in your PHP.ini.
Once you fix the handling of your PHP files, I'm sure it will work. If not, post your code and try again, so we can provide a more specific answer.
5 Comments
Ben Schwabe
You may also want to check that you havent accidentally forgotten to close any real html comments.<!--COMMENT-->
Brad
@bspymaster, That won't make any difference. PHP doesn't read HTML, it only reads the PHP within its "tags".
Ben Schwabe
Im saying if for instance you had the code
<!--this is a comment that I forgot to close <?/*php code here*/?> Then that will display as an html comment.Brad
@bspymaster, Try it.
<!-- HTML comment <?php include('somefile.php'); ?> I guarantee you that in a properly configured environment, PHP will include that file just fine.Ben Schwabe
I stand corrected. @Hubrid, listen to Brad, not me. I evidently don't know what I'm talking about.