Skip to content
Advertisement

PHP script not working in HTML file

I’m new to PHP. I installed XAMPP and have Apache running. I created helloworld.php in XAMPP’s htdocs and got PHP to display in my browser. My question is, why does my PHP script in my HTML file not display in my browser? Ive never installed PHP on its own. Should I also install it? Would it conflict with XAMPP. My code is below. Any assistance will be appreciated. Thanks in advance:

<html>
    <body>
        <?php
            echo "Hello PHP World";
        ?>
    </body>
</html>

Advertisement

Answer

XAMPP already includes PHP, but unless you end the script name with .php it is unlikely to be processed by the PHP engine.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement