You now have Apache web server running. In order to see any web page (html or php) when you enter "localhost" in your browser, the html or php file must be in the Document Root folder (==C:/xampp/htdocs/ or whatever you have set Document Root to be in the Apache configuration file (httpd.conf) ). If your files are in subordinate folders, you would have to include the path when you enter it in your browser, so maybe "localhost/myfiles/index.html" or something. It is not good to leave ANY folder in the Document Root or subfolders without a file named exactly: "index.html" or "index.php" because if there is no such file, you will see the index of files, as you have already seen. That's probably not a problem on your own computer, but it is asking for disaster on a server that's accessible over the Internet. It allows absolutely anyone to see and copy your files and perhaps then do more damage, with that knowledge.
You cannot ever use a word processor to work on files on a web server, unless you explicitly save them as plain text files. You should immediately form the habit of either using an HTML Editor (several free ones are available to download--just Google for them) or using Notepad. This goes for the configuration file (httpd.conf) and html and php files.
My suggestion is this: open Notepad, enter the following--no more, no less--and save it in your Document Root folder (not in any subfolders) as index.html:
Code: Select all
<html>
<head>
<title>This is a test</title>
</head>
<body style="text-align:center; font-size:18pt; font-weight:bold;">
THIS IS MY FIRST TEST PAGE
</body>
</html>Once you have that working, you can try a php script: again open Notepad, enter exactly the following and save it in your Document Root folder as firstphp.php:
Code: Select all
<html>
<head>
<title>First PHP Script</title>
</head>
<body style="text-align:center; font-size:18pt; font-weight:bold; color:#0000FF;">
<?php
echo "THIS IS BEING SENT FROM MY FIRST PHP SCRIPT";
?>
</body>
</html>