Re: [mp2] working directory of scripts
[prev]
[thread]
[next]
[Date index for 2005/01/15]
----- Original Message -----
From: "Geoff Mishkin" <gmishkin@xxx.xx.xxx>
To: <modperl@xxxx.xxxxxx.xxx>
Sent: Saturday, January 15, 2005 12:26 PM
Subject: Re: [mp2] working directory of scripts
> Hi Sean, thanks for the reply.
>
> However, my problem is that the working directory is set to the root of my
> filesystem, not the document root. I'm not sure an alias would help here;
Where the document root is set doesn't have anything to do with using Alias
or ScriptAlias. These directives just map a physical file location to a
url. This is equivalent to using a symlink (with better maintainability)
within the document root.
Another issue: is your document root really set to '/'? That seems like a
very large security issue!
I would really look at the documentation about url mapping (that I sent
earlier) or, alternatively, using a set of rewrite rules. Have you tried
these? If so, why didn't they work? I am relatively new to web development
myself, so perhaps I am missing the point....
Sean
> the only thing I can think of (other than using chdir()--which would
> involve changing all the scripts for the webapps I'm using) would be to
> make symlinks at the root of my filesystem pointing down to where stuff
> is.
> That doesn't seem like a good idea, and there'd have to be one pointing to
> each directory where there was a script that used relative pathnames.
>
> --Geoff Mishkin <gmishkin@xx.xxx>
>
>
> Sean Davis wrote:
>
>> Geoff,
>>
>> You may want to set an alias for the directory for your scripts. You
>> could do something like (from apache2 docs):
>>
>> the Alias directive will map any part of the filesystem into the web
>> space. For example, with
>> Alias /docs /var/web
>>
>> the URL http://www.example.com/docs/dir/file.html will be served from
>> /var/web/dir/file.html. The ScriptAlias directive works the same way,
>> with
>> the additional effect that all content located at the target path is
>> treated as CGI scripts.
>>
>>
>> Check here for more details.
>>
>> http://httpd.apache.org/docs-2.0/urlmapping.html
>>
>> Sean
>>
>> ----- Original Message -----
>> From: "Geoff Mishkin" <gmishkin@xxx.xx.xxx>
>> To: <modperl@xxxx.xxxxxx.xxx>
>> Sent: Saturday, January 15, 2005 11:08 AM
>> Subject: [mp2] working directory of scripts
>>
>>
>>> I've got mod_perl (version 1.99.11) all up and running on Apache
>>> (version
>>> 2.0.52), but the working directory of my scripts is always set to / when
>>> mod_perl runs them, instead of being the directory the script is in.
>>> This
>>> wreaks havoc if the scripts are using relative pathnames. I was able to
>>> solve the problem with loading extra Perl modules by adding *use lib
>>> qw(/var/www/localhost/perl/mt/lib);* to my mod_perl startup script, but
>>> that doesn't help if my site scripts uses relative paths for other
>>> things.
>>>
>>> I looked through the docs and configuration directives but didn't find
>>> anything appropriate, please tell me if I'm missing something. I asked
>>> in my distro's (Gentoo) forum but haven't gotten a reply (or even many
>>> views :P). I also browsed this list but didn't turn up anything that
>>> looked related. How do I make mod_perl set the working directory of
>>> each
>>> script the way I want? Or is there a reason that it always sets the
>>> working directory to /?
>>>
>>> --Geoff Mishkin <gmishkin@xx.xxx>
>>>
>
>