Start learning with our library of video tutorials taught by experts. Get started
Viewers: in countries Watching now:
PHP is a popular, reliable programming language at the foundation of many smart, data-driven websites. This comprehensive course from Kevin Skoglund helps developers learn the basics of PHP (including variables, logical expressions, loops, and functions), understand how to connect PHP to a MySQL database, and gain experience developing a complete web application with site navigation, form validation, and a password-protected admin area. Kevin also covers the basic CRUD routines for updating a database, debugging techniques, and usable user interfaces. Along the way, he provides practical advice, offers examples of best practices, and demonstrates refactoring techniques to improve existing code.
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.
Find answers to the most frequently asked questions about PHP with MySQL Essential Training.
Here are the FAQs that matched your search "":
Sorry, there are no matches for your search ""—to search again, type in another word or phrase and click search.
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.