1

The following html does not produce any response from the included php file.

<!DOCTYPE html>
<html>
<body>
Here is some text. <br>
<?php include 'hello.php'; ?>
</body>
</html>

The hello.php file contains the ubiquitous <?php echo "Hello world!"; ?>

Additional info:

  • The line of text displays properly.
  • PHP is installed and running properly. A call to from within the source directory produces the expected config data.
  • The html document is named test.php
  • error_reporting(E_ALL); produces no additional data.

  • 20
    • Does your html file have a `.php. extension? Do you have error reporting turned on? Commented Dec 17, 2014 at 14:28
    • 1
      error_reporting(E_ALL); add this line as well ini_set("display_errors", 1); Commented Dec 17, 2014 at 14:31
    • 1
      Which web server are you using?? Have to enabled server-includes on the server?? Commented Dec 17, 2014 at 14:31
    • 1
      change include to require and see if there's a error Commented Dec 17, 2014 at 14:32
    • 1
      I've tested here, and it worked fine. Appears to be something related to your config/environment/web-server. Commented Dec 17, 2014 at 14:34

    1 Answer 1

    1

    at the end or first of your html page add this o see what is disrupting:

    <?php error_reporting(-1); ?>
    

    and this for your include:

    <?php include("file.php"); ?>
    
    Sign up to request clarification or add additional context in comments.

    Comments

    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.