-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.

1 Answers1

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.

Dimitris Damilos
  • 2,363
  • 5
  • 23
  • 46
  • Yes, change the bottom line from `` to ` – alex Jun 08 '17 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 – Jeroen Somers Jun 08 '17 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. – Dimitris Damilos Jun 08 '17 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. – Jeroen Somers Jun 08 '17 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. – Funk Forty Niner Jun 08 '17 at 14:35
  • True. But he said "I made my first html test page" and I assumed there was no way he could have edited his .htaccess/Apache config to do that. – Dimitris Damilos Jun 08 '17 at 14:39
  • it's fixed, I opened it locally instead of through htdocs from XAMPP Now my php file is in the HTDOCS folder from xampp and it works – Jeroen Somers Jun 08 '17 at 14:47
  • Happy to hear that. Please mark this Answer as correct if it was. :) – Dimitris Damilos Jun 08 '17 at 14:52