-4

I'm really new to PHP so I was searching for answers to my question, but none of the source codes worked for me, however they seem right and they are approved codes. I finally got to the point to build my program again from the absolute basics, but instead answers I got just more questions. My PHP code is here: <?php echo "<p>WTF</p>"; ?>

And the result: image of the page

Please someone help me, I think I'm running insane...

  • 2
    Looks like either you didn't install php in your webserver or you're not even using a webserver to begin with when loading the page. What is the URL in the browser's address bar when you see this result? – ADyson Apr 26 '22 at 16:16
  • https://stackoverflow.com/questions/5121495/php-code-is-not-being-executed-but-the-code-shows-in-the-browser-source-code?answertab=votes#tab-top – Quentin Apr 26 '22 at 16:18

1 Answers1

0

Open your terminal in the folder where your php file is located. Write

php -S localhost:8000

and open http://localhost:8000 in your webbrowser.

  • Now I do get (in my browser): "The requested resource / was not found on this server." what should I do next (I do know it), but the question asker on stackoverflow might have the faintest idea on what to do next...... – Luuk Apr 26 '22 at 16:28
  • The command line part seems to work, but if I try to type this in my webbrowser, it returns a 404 error – B4lint0413 Apr 26 '22 at 16:33
  • When you have your PHP file saved as "test.php", you can try to visit: `http://localhost:8000/test.php` . – Luuk Apr 26 '22 at 16:37
  • Oh, sorry! Now it's obvious, I am just really exhausted cuz I had an huge exam today. – B4lint0413 Apr 26 '22 at 16:52