Reputation: 692
Nothing appears in the browser when I open this file. I assumed it's supposed to show "it works," but instead it shows nothing when the file is opened in the browser.
<!DOCTYPE html>
<html>
<body>
<?php
echo "It works";
?>
</body>
</html>
Upvotes: 0
Views: 4521
Reputation: 945
PHP is a server side language. If you want any php page to execute then definitely you need server whether it is virtually created or it is real. You are trying to run the php page directly which has no meaning to browser. You may use software like Wamp, Xamp that creates a virtual server on your PC. Try using this, then come back if you face any problem. For more info on how to use these, just GOOGLE them. You'll find millions of solutions there. Good Luck!
Upvotes: 0
Reputation: 139
www
folder name as test.php
, and go to localhost/test.php
in your browser, you will see it works
file:///D:/web/hello.html
. But
<?php ... ?>
is not valid html so you got a blank page.some links that might be useful to you
Upvotes: 1
Reputation: 11
PHP files are executed in Server , You need a local host server like LAMP or Wamp needed to execute a PHP script
Upvotes: 1