Databases Reference
In-Depth Information
server by using the appropriate XAMPP startup command, or the
apachectl
or
apache2ctl commands described later in this section in “Starting and Stopping
Apache.”
If you see some response when you try to load a page in your browser, you can try
placing content in the server's document root. Let's see how to find this directory.
The Apache Document Root
The
document root
is the base or parent directory in which the web server stores web
resources (such as HTML, PHP, or image files) and serves them to web browsers. For
the Apache web server, common locations of the document root include:
Linux
/var/www/html
,
/var/www/htdocs
, or
/var/www
for a distribution installation;
/usr/
local/apache/htdocs
for a standalone installation, and
/opt/lampp/htdocs
for an
XAMPP installation.
Windows
C:\Program Files\xampp\htdocs
for an XAMPP installation, and
C:\Program Files
\Apache Group\Apache2\htdocs
if Apache is installed independently
Mac OS X
/Applications/xampp/htdocs
for an XAMPP installation, and
/Library/WebServer/
Documents
for the installation of Apache that is part of the standard Mac OS X
configuration
If you're using a Linux system and don't know where your server's document root is,
search for it by following these instructions.
First, log in as the system superuser by typing
su -
in a terminal window. Then try to
list the common document root directories that we listed previously:
#
ls --directory /var/www/html /var/www/htdocs /var/www /usr/local/apache/htdocs
/bin/ls: /var/www/htdocs: No such file or directory
/bin/ls: /usr/local/apache/htdocs: No such file or directory
/var/www /var/www/html
The
--directory
option asks the
ls
program to list only directory names, and not their
contents.
If you get an error message for a directory, that directory doesn't exist. Where the
directory name is listed, as for
/var/www
and
/var/www/html
above, the directory exists.
One of these is likely to be the document root. If none of the directories exist, you can
try searching your whole filesystem for a directory called
htdocs
:
#
find / -type d -name htdocs
Be patient; this may take a few minutes. Any directory it finds is likely to be the directory
root; if more than one is found, you'll need to experiment by creating files in each to
determine which is the one used by your Apache installation.