Why not use the environmental variable set by apache for CGI scripts? DOCUMENT_ROOT should work...
No parsing necessary... Greetings, Vinai > On Sun, 3 Mar 2002 17:03:43 +0100 > Russell Coker <[EMAIL PROTECTED]> wrote: > >> On Sun, 3 Mar 2002 16:59, Patrick Hsieh wrote: >> > Hello "Luc MAIGNAN" <[EMAIL PROTECTED]>, >> > >> > >> > BTW, in Debian woody, the executable "apache" is under >> > /usr/sbin/apache, which can't be executed by the default uid of >> > apache(www-data). >> >> Why not? >> >> root@lyta:~# sudo -u www-data bash >> bash: /home/root/.bashrc: Permission denied >> www-data@lyta:~$ /usr/sbin/apache -v >> Server version: Apache/1.3.23 (Unix) Debian GNU/Linux >> Server built: Feb 7 2002 13:56:56 >> www-data@lyta:~$ /usr/sbin/apache -V >> Server version: Apache/1.3.23 (Unix) Debian GNU/Linux >> Server built: Feb 7 2002 13:56:56 >> Server's Module Magic Number: 19990320:11 >> Server compiled with.... >> -D EAPI >> -D HAVE_MMAP >> -D HAVE_SHMGET >> -D USE_SHMGET_SCOREBOARD >> -D USE_MMAP_FILES >> -D HAVE_FCNTL_SERIALIZED_ACCEPT >> -D HAVE_SYSVSEM_SERIALIZED_ACCEPT >> -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT >> -D HTTPD_ROOT="/usr" >> -D SUEXEC_BIN="/usr/lib/apache/suexec" >> -D DEFAULT_PIDLOG="/var/run/apache.pid" >> -D DEFAULT_SCOREBOARD="/var/run/apache.scoreboard" >> -D DEFAULT_LOCKFILE="/var/run/apache.lock" >> -D DEFAULT_XFERLOG="/var/log/apache/access.log" >> -D DEFAULT_ERRORLOG="/var/log/apache/error.log" >> -D TYPES_CONFIG_FILE="/etc/apache/mime.types" >> -D SERVER_CONFIG_FILE="/etc/apache/httpd.conf" >> -D ACCESS_CONFIG_FILE="/etc/apache/access.conf" >> -D RESOURCE_CONFIG_FILE="/etc/apache/srm.conf" >> www-data@lyta:~$ >> >> > >> > I'm afraid the cgi run-time uid can't execute /usr/sbin/apache -V. >> > >> > >> > On Sun, 3 Mar 2002 16:44:32 +0100 >> > >> > "Luc MAIGNAN" <[EMAIL PROTECTED]> wrote: >> > > You only have to execute httpd -V (be careful 'v' in lowercase only >> > > prints Apache version). You will have all options of the server. You >> > > only have to parse '-D SERVER_CONFIG_FILE' which gives you relative >> > > path to the config file (relative path from main Apache path which >> > > is contained in -D HTTP_ROOT). >> > > >> > > Hope this helps >> > > >> > > Regards >> > > >> > > -----Message d'origine----- >> > > De : Patrick Hsieh [mailto:[EMAIL PROTECTED]] >> > > Envoye : dimanche 3 mars 2002 16:25 >> > > A : [EMAIL PROTECTED] >> > > Objet : any good way to get the apache DocumentRoot value? >> > > >> > > >> > > Hello list, >> > > >> > > This may be kind of off-topic here, but I wan to know is there any >> > > good way to know the localhost apache DocumentRoot path? >> > > >> > > My situation is, I have to distribute my cgi script(could be python >> > > or perl)to some apache servers, having no idea where the >> > > DocumentRoot path is, I have to parse a config file at >> > > $DocumentRoot/setup/config.ini >> > > >> > > Is there any way for the script to know exactly where the correct >> > > DocumentRoot is? It could have no idea about where httpd.conf is, >> > > either. >> > > >> > > Any idea is highly welcome. >> > > -- >> > > Patrick Hsieh <[EMAIL PROTECTED]> >> > > -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]