Reputation: 51
I have been learning some basic PHP via codeacademy.com recently, and am currently attempting to run it on my PC. I am using jEdit to write the code, and xampp/Apache as a server. The actual code looks like:
<html>
<body>
<?php
echo "<p> I know how to run a PHP Program in XAMPP! <\p>";
?>
</body>
</html>
Running this code by typing
http://localhost/[my directory]
into the URL bar of my browser returns Error 403 - access to the directory is forbidden on this server.
I've done some searching around, and I understand that I need an index.html or index.htm file, but I don't know what these are - my knowledge of html is extremely limited.
If someone could offer any help on how I'd bypass the forbidden access message, or if there's another way to run PHP code, I'd be extremely thankful.
Upvotes: 0
Views: 67
Reputation: 401
Name the file with your code in it: "index.php". Make sure this file is in your "xampp/htdocs/" directory.
Additionally you might want to put this file within its own folder in that directory for the sake of keeping all of your files specific to one project together.
You can then access index.php with "http://localhost:port#/folder_name/"
Upvotes: 1