PDA

View Full Version : Finding full server paths



Cei
07-26-2002, 07:11 PM
I'm trying to create a .htaccess/.htpasswd area on my website - but I don't know the full server path to my file - is there any way to discover this path, or will I have to contact my provider to make them give me the path?
Lastly, what does the "AuthGroupFile /dev/null" line do in the .htaccess file? Is it required?

MCookie
07-26-2002, 11:55 PM
Hi, to find any path on your server, just throw the script below in any directory (any directory that you can use CGIs in, that is), chmod it 755 and call it from your browser. It will show you the serverpath on your screen :)


#!/usr/local/bin/perl
print "Content-type: text/html\n\n";
print "<html><head></head><body>\n";
print "Your path is working and pointing to Perl version:<p>\n";
print "<B>$]</B><p>\n";
print "The complete path to this script is:<p>\n";
print "<B>$ENV{'SCRIPT_FILENAME'}</B><p>\n";
print "The relative URL of this script is:<p>\n";
print "<B>$ENV{'SCRIPT_NAME'}</B>\n";
print "</body></html>\n";
exit;

About the .htaccess; "AuthGroupFile /dev/null" is the filename containing a list of groups and the users they include. "Null" means it doesn't exist. Not sure if it is required.

oracleguy
07-27-2002, 06:31 AM
Or you could use this ASP code:

<%=Server.MapPath%>

mouse
07-27-2002, 02:55 PM
Or this php:

<?=$DOCUMENT_ROOT;?>

SSJ2Gohan
08-14-2002, 04:01 AM
I cant get that first perl option to work. Nothing shows up except exactly what is typed. Can anyone tell me how to properly write this in notepad or something like that?