Question

I have a mod_perl2 module that writes some files to the working directory. The standard working directory of mod_perl2 or Apache2 seems to be "/". Of course, Apache is not allowed to write files in this directory.

Can anyone tell me how I can change the working directory or the directory mod_perl2 writes to?

I use Apache2 Prefork on SLES 10.

Was it helpful?

Solution

Can you do a perl chdir(script-dir) at the beginning of the script ?

On a second thought that would defeat the purpose when you try to use in threaded scenario where changing the working directory might break the threads.

You could try RegistryPrefork module ?

# httpd.conf
PerlModule ModPerl::RegistryPrefork
Alias /perl-run/ /home/httpd/perl/
<Location /perl-run>
  SetHandler perl-script
  PerlResponseHandler ModPerl::RegistryPrefork
  PerlOptions +ParseHeaders
  Options +ExecCGI
</Location>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top