Logo         Community
The Company
Your Account
Contact Us
Getting More Out Of Apache (part 2)
Learn about Apache's authentication, logging and URL rewriting capabilities.

| Timmmmmmbbbbberrrr! |

You may not know this, but Apache comes with some pretty impressive logging capabilities, which allow you to record demographic information about visitors to your Web site. And these logging capabilities can be customized to deliver exactly the information you need for later analysis.

Apache comes with two types of logs: there's the "access log", which tracks each and every request made to the Web server, and the "error log", which tracks internal server errors, missing file and the like. There are a number of configuration directives in the "httpd.conf" file which allow you to control Apache's default logging behaviour.

The ErrorLog directive specifies the location of the error log.

ErrorLog logs/error.log

The CustomLog directive specifies the location of the server's access log, together with a format for the log file (as defined in the LogFormat directive). The default setting is the Common Logfile Format, which places each request on a separate line; this format records the IP address, the date and time, the bytes sent, and the first line of the client request.

LogFormat "%h %l %u %t \"%r\" %>s %b" common
CustomLog logs/access.log common

The variables that you see in the LogFormat directive are server variables that return various identifiers for each client request - you can use these to create your own log format. More information about each variable does can be obtained from the Apache manual at http://httpd.apache.org/docs/mod/mod_log_config.html#customlog , or from the list below.

%h - requesting host

%b - bytes sent

%{VARNAME}e - value of environment variable VARNAME

%t - timestamp

%h - remote host

%T - time taken to serve request (seconds)

%U - URL requested

%s - return code for request

%{User-agent}I - remote user agent identifier

How to do Everything with PHP & MySQL
How to do Everything with PHP & MySQL, the best-selling book by Melonfire, explains how to take full advantage of PHP's built-in support for MySQL and link the results of database queries to Web pages. You'll get full details on PHP programming and MySQL database development, and then you'll learn to use these two cutting-edge technologies together. Easy-to-follow sample applications include a PHP online shopping cart, a MySQL order tracking system, and a PHP/MySQL news publishing system.

Read more, or grab your copy now!

previous page more like this  print this article  next page
In trog...
Logging With PHP
Building A Quick-And-Dirty PHP/MySQL Publishing System
Output Buffering With PHP
Date/Time Processing With PHP
Creating Web Calendars With The PEAR Calendar Class
In the hitg report...
Crime Scenes
Animal Attraction
Lord Of The Strings
In boombox...
Patience - George Michael
Think Tank - Blur
My Private Nation - Train
In colophon...
Hostage - Robert Crais
The Dead Heart - Douglas Kennedy
Right As Rain - George Pelecanos
In cut!...
American Chai
The Core
Find out how you can use this article on your own Web site!

Copyright © 1998-2018 Melonfire. All rights reserved
Terms and Conditions | Feedback