It’s been a few months since I’ve used PHP so I’m assuming I’m just forgetting something trivial. No matter what PHP I put into my .php file, the PHP part doesn’t run. Even something as simple as this
<html>
<body>
<?php
echo "hey";
?>
</body>
</html>
doesn’t work–it produces a blank page. Thanks for your help!
EDIT: I forgot to mention that I’m viewing the pages in my browser by typing in the file location into the URL. Ex) file:///C:/Users/Student/Documents/test.php
This URL is opened by your browser from the local filesystem. PHP is executed by a webserver. The browser doesn’t understand PHP. Your PHP after execution by server generates HTML which is finally displayed by your web-browser.
So, you should host a local webserver and access it as
http://localhost/xxx.php,if you want the PHP to execute. Xampp perhaps.