This happens under Apache 2 because mod_perl expects that it might be run under a single-process multi-threaded version of Apache, where changing the working directory of the process would break other threads. The multi-threaded mode was a design change in Apache 2 to improve performance in environments (like Windows) which do not handle lots of processes well.
The good news is that if you're on a unix-ish system, you're probably still running Apache in forking mode...and you can safely override mod_perl's default behavior to act more like the original. You'll need the ModPerl::RegistryPrefork module. (When I started using it I had to copy ModPerl/RegistryPrefork.pm into one of my @INC directories manually, but it looks like it's an official part of the distribution now.) With that installed, modify your Apache configuration to use ModPerl::RegistryPrefork in place of ModPerl::Registry, and your mod_perl scripts should run in their own directories.
In reply to Re: mod_perl's cwd not the same as the scripts location.
by Bob9000
in thread mod_perl's cwd not the same as the scripts location.
by OnionKnight
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |