If you're working with Mac OS X and want to use separate components for your AMP
stack, you're ahead of the game, because Mac OS X includes both Apache and PHP
in its default installation.
You just have to know how to turn them on.
First, I'll show you how to turn on Apache.
Go to the Apple menu and choose System Preferences. Then from there, click
Sharing, which you'll find under Internet & Wireless.
Mac OS X refers to the Apache web server as Web Sharing, which you can activate
by simply checking the check mark.
When you activate Web Sharing, you're turning the built-in Apache web Server on.
On this screen it will show you the IP address of your computer.
Assuming that your computer is getting its IP address dynamically using an
architecture known as DHCP, this IP address will be different on every computer.
Notice that there are two possible links.
The bottom one is a web site for the entire computer; the top one though, is a
web site for the currently logged-in user.
I'm logged in on my Mac as a user named LDC, for lynda.com, and so my
personal web site is under the local IP address / then a tilde character,
and then the username.
Now you don't have to use this dynamically generated address.
If you click it, you'll see the default web page.
Now, I'm recording on version 10.6 of Mac OS X. That's Snow Leopard.
If you're using another version of Mac OS X, the web page may look different,
but you should still see a confirmation that the Apache web server is running.
But you can actually get to exactly the same web page and exactly the same
location on your disk by using the local IP address that's common to all
computers, 127.0.0.1.
Once again, I'm referring to the LDC folder using the tilde as a prefix, and that
takes me to the same place.
Yet another alternative is to use the word localhost.
The localhost DNS name always points to the IP address 127.0.0.1.
Typically, when you're doing local development, you should either use localhost
or the IP address, the 127.0.0.1 address.
Your instructors will typically use these addresses, rather than anything
that's dynamically generated, and that will make sure that you're using the
same address on your computers as they did on theirs and that it's working
the same for everybody.
Now I'll show you where these files are stored.
I'll go to Finder, to my personal directory, LDC. Under there, go to a folder named Sites.
You'll find this, file index.html, and an images folder containing a few basic graphics.
I'll double-click index.html to open it in a browser, and you'll see that it
looks exactly the same.
So this folder, the Sites folder under your home directory, is what's known
through Apache as the document root.
Each user that's logged in to a particular Mac has their own personal document
root, and then there is also a computer-wide document root, which is stored on
your Mac hard disk under /library/web server/documents.
So once you know how easy it is to turn your Apache web server on, you'll be
ready to go onto the next step, activating PHP,
and I'll show you how to do that in the next video.