Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
In this movie, we're going to talk about how to go about finding the document root. It's a very important folder directory that we need to locate, so that we know where to put our web files as we work. We're working with WampServer, assuming you installed it in the default location, the document root is going to be inside local C drive, inside the WAMP folder or wherever you installed WAMP. And then from there, it's the www folder, that is the file that is going to be served up by Apache. Apache is looking at this directory and returning pages from this directory. So all of our project files need to go here.
Now there is also another way that you can get there which is from the WampServer menu over here at the side, it was www directory. That is our document root. It opens up the exact same thing. And index.php, well, that's this test page, that's right here for local host. If you go to local host, you'll open up Firefox and it loads local host, whhich is the same thing as local host index.php. That's the default page is index.php so it's implied.
So that is what's loading up here, is that page. So that shows you the relationship between where files are stored on the hard drive and where we access them in the browser. Local host is what we used to get to Apache, and to get to this document root. And then we provide whatever else we need after that to be able to locate the file inside whatever nested directories might be there. So you're going to want to put all of the PHP project files that we create, in this www directory. And then you'll access them from the browser by typing it this way, not by double-clicking on the file.
It's very important, we need to tell Apache that it has to process these files. So we don't want to just open up PHP on it's own. We have to get there by going through Apache, so that Apache can interpret them and return good HTML to us. Now, one other note that I want to make is that it's different from where I'm going to be on the Mac. And I'm going to be demonstrating everything on the Macintosh. On the Mac, I'm going to be locating those files by using localhost/ and then tilde and then my username. For on Windows, though, it's just going to be the localhost part. So anytime you see me start to type that longer string on the Mac followed by some other file names, you'll just take out that username portion and just use localhost/ and then whatever comes after that, because on the Mac, my document root is in a slightly different place.
But if you keep that one change in mind, you won't get lost.
Get unlimited access to all courses for just $25/month.Become a member
61 Video lessons · 100111 Viewers
56 Video lessons · 113145 Viewers
71 Video lessons · 82010 Viewers
131 Video lessons · 39347 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.