[plug] Making a PHP application's Apache logs meaningful

Adam Ashley adam_ashley at softhome.net
Tue Aug 30 15:58:35 WST 2005


On Tue, 2005-08-30 at 15:34 +0800, Matthew Lambie wrote:
> 'Afternoon all,
> 
> Here's my dilema; I'm sure someone can point me towards a solution.
> 
<snip>

What you want to look into is the Apache 2 configuration option
AcceptPathInfo (In apache 1.3 this directive is always on) and the PHP
variable $_SERVER['PATH_INFO']

With this turned on you could use URLs like:

index.php/21?foo=bar

Inside PHP you would have the standard $_REQUEST['foo'] = 'bar' but also
$_SERVER['PATH_INFO'] would be '/21' bit of string manipulation to pull
out the bits you want and there you go.

Apache would log requests to this as index.php/21

Add in a bit of mod_rewrite foo and you can get the index.php part of
the url hidden.

Adam Ashley




More information about the plug mailing list