0

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 1

3

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.

Sign up to request clarification or add additional context in comments.

5 Comments

You may also want to check that you havent accidentally forgotten to close any real html comments.<!--COMMENT-->
@bspymaster, That won't make any difference. PHP doesn't read HTML, it only reads the PHP within its "tags".
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.
@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.
I stand corrected. @Hubrid, listen to Brad, not me. I evidently don't know what I'm talking about.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.