-1

I just started PHP I got my XAMMP server up and running and now I made my first html test page and added one line of PHP script but it isn't showing in my browser.

    <!DOCTYPE html>
<html lang="nl">
<head>
    <title>Mijn php-script</title>
</head>
<body>
    <?php
    phpinfo();
    ?>
</body>
</html>

It does however shows the title I gave it, can anybody tell me why the rest isn't showing? it should show the info version page of my PHP.

4
  • 2
    Does it output the php-source as is?
    – Halcyon
    Jun 8, 2017 at 14:10
  • Yes if I click the right mouse button and go to the source of the page it shows me my code Jun 8, 2017 at 14:18
  • you're running this off of your own computer? if so, how? @JeroenSomers Jun 8, 2017 at 14:38
  • @JeroenSomers you will need to take it up with the answer below. I can't keep looking at the question/comments to see an update/replies; good luck. Jun 8, 2017 at 14:45

1 Answer 1

3

You need to save your file as .PHP and not as .HTML in order to be able to run this. Also, you need to fix the HTML closing tag in the end, as you are closing the HEAD again.

8
  • Yes, change the bottom line from </head> to </html>
    – alex
    Jun 8, 2017 at 14:14
  • I did save it as a .php file I fixed the HTML closing tag in the end and deleted the second HEAD closing tag. Still it doesn't work Jun 8, 2017 at 14:15
  • Give us a screenshot so we can see what you see. Because this code you posted with the corrections I suggested works fine. UNLESS, your Apache hasn't started. Check XAMPP's Apache indication. Jun 8, 2017 at 14:20
  • I'm updating my apache as we speak, I had a very old version which was running fine but we live in 2017 now, keep you posted on the progress. Jun 8, 2017 at 14:34
  • Although true; one can instruct their system to treat .html files as php. Edit (ping) @DimitrisDamilos seeing your comment below, I take it that was for me. You should have pinged me directly. Jun 8, 2017 at 14:35

Not the answer you're looking for? Browse other questions tagged or ask your own question.