I'm steadily making progress with getting a collection of mod_perl 1
compatibale scripts working with mod_perl 2 using the backward
compatibility mode.

However, I find that the working directory of all scripts is "/". This
occurs for both ModPerl::Registry and Apache::Registry. This causes
many scripts to fail because they call open() using a relative
pathname.

Surely the working directory of a script should be the directory in
which it resides?

It does not seem to matter what directory I am in when I invoke httpd;
the script's current directory is always "/".

I am mystified.

Here is the output from a simple "printenv" cgi script (with some of
the env variables snipped for brevity), which also prints the working
directory using getcwd (and invokes "ld -al" to list the contents of
the current directory):

Content-type: text/plain

DOCUMENT_ROOT="/dir1/dir2/httpd/htdocs"
EXITSERVERLOC="http://localhost/cgi-bin/index.cgi";
GATEWAY_INTERFACE="CGI-Perl/1.1"
HOME="/mps/home/cdi"
HTTP_ACCEPT="image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/msword, application/vnd.ms-excel,
application/vnd.ms-powerpoint, application/x-shockwave-flash, */*"
HTTP_ACCEPT_ENCODING="gzip, deflate"
HTTP_ACCEPT_LANGUAGE="en-gb"
HTTP_CONNECTION="Keep-Alive"
HTTP_USER_AGENT="Mozilla/4.0 (compatible; MSIE 5.01; Windows NT)"
MOD_PERL="mod_perl/1.99_09"
QUERY_STRING=""
REQUEST_METHOD="GET"
REQUEST_URI="/cgi-bin/printenv"
SCRIPT_FILENAME="/dir1/dir2/httpd/cgi-bin/printenv"
SCRIPT_NAME="/cgi-bin/printenv"
SERVER_PORT="8000"
SERVER_PROTOCOL="HTTP/1.1"
SERVER_SIGNATURE="<address>Apache/2.0.46 (Unix) mod_perl/1.99_09
Perl/v5.8.0 Server at homer Port 8000</address>\n"
SERVER_SOFTWARE="Apache/2.0.46 (Unix) mod_perl/1.99_09 Perl/v5.8.0"
TZ="GB"

Working directory is /
total 329

drwxr-xr-x  36 root     root        1024 Jul 16 09:50 .
drwxr-xr-x  36 root     root        1024 Jul 16 09:50 ..
lrwxrwxrwx   1 root     root           9 Jun 19 09:59 bin -> ./usr/bin
drwxr-xr-x   2 root     root         512 Jun 27 14:42 cdrom
drwxr-xr-x  16 root     sys         4608 Jun 27 15:44 dev
drwxr-xr-x   4 root     sys          512 Jun 19 10:28 devices
drwxr-xr-x  51 root     sys         3584 Jul 18 14:04 etc
drwxr-xr-x   3 root     sys          512 Jun 19 09:57 export

and so on...


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

Reply via email to