[mapguide-users] Apache as CGI cannot customize authentication
dmorissette at mapgears.com
Thu Jun 29 08:46:53 EDT 2006
I realize this won't fix the issue completely, but as a workaround, if
you can afford to let Apache handle the user/password validation (i.e.
create a .htaccess and htpasswd file, etc.) then you can get the user
name of the authenticated visitor with the $_SERVER['REMOTE_USER']
variable. This variable works with the PHP CGI.
> PHP in Apache2 in MapGuide is loaded as a CGI executable, as this line in
> httpd.conf shows:
> Action application/x-httpd-php "/php/php-cgi.exe"
> However, you cannot customize your authentication unless PHP runs as a
> module, that is, by commenting out this line and replacing it with:
> LoadModule php5_module c:/php/php5apache2.dll
> When you do that and restart Apache, you can trap the user login and
> password. For example:
> if ($_SERVER[PHP_AUTH_USER])
> Header("WWW-Authenticate: Basic realm=\"MapGuide Test Site\"");
> Header("HTTP/1.0 401 Unauthorized");
> <input type="submit" name="auth" value= "Authenticate" />
> However, when you do that you lose the MG functions, which I presume are in
> php_MapGuideApi.dll, such as MgInitializeWebTier
> Is there a way that you can make the MG functions available to PHP when you
> load it as a module?
More information about the Mapguide-users