# Apache+FastCGI working dir problem

**URL:** <https://www.ruby-forum.com/t/apache-fastcgi-working-dir-problem/133664>\
**Category:** Rails\
**Created:** [April 2, 2008, 12:37pm UTC](https://www.ruby-forum.com/t/apache-fastcgi-working-dir-problem/133664 "2008-04-02T12:37:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![seeah](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b19c9b/32.png) [@seeah](https://www.ruby-forum.com/u/seeah)\
**Post date:** [April 2, 2008, 12:37pm UTC](https://www.ruby-forum.com/t/apache-fastcgi-working-dir-problem/133664/1 "2008-04-02T12:37:00Z")

</div>

I have an standard Apache2+mod\_fcgi+Rails layout. The application has  
a few of my own .rb files under /lib/ which I require in /config/  
environment.rb.  
When running through Mongrel/Webrick, I can do require ‘lib/mylib.rb’,  
but in the FastCGI environment (probably because the application’s  
runtime  
working directory has moved from / to /public/) I all requires in /  
config/environment.rb fail unless I put a …/ in fron of each path.

I’ve tried googling on how to solve this issue but without results.  
The Apache2+mod\_fcgi layout should be pretty common so I don’t  
understand why this issue even came up.  
Should I even be requiring files in /config/environment.rb?

Might it be that because the working directory is /public/ instead  
of /, file uploads (using file\_column) are also failing? Because right  
now they are.  
There might be a connection between those two problems.

Regards,  
Erik A.

---

<div class="post-metadata">

**Author:** ![seeah](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b19c9b/32.png) [@seeah](https://www.ruby-forum.com/u/seeah)\
**Post date:** [April 2, 2008, 2:31pm UTC](https://www.ruby-forum.com/t/apache-fastcgi-working-dir-problem/133664/2 "2008-04-02T14:31:16Z")

</div>

I did a check on Apache access.log and error.log and Rails’s own /log/  
production.log.

- access.log shows an incoming POST request when I save the model with  
uploaded file data.
- error.log does not show anything.
- /log/production.log logs all requests except for the one that is my  
file upload POST request

Could mod\_fcgi be incorrectly directing multipart POST requests to the  
Rails FastCGI process?

Erik

---

<div class="post-metadata">

**Author:** ![seeah](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b19c9b/32.png) [@seeah](https://www.ruby-forum.com/u/seeah)\
**Post date:** [April 2, 2008, 2:41pm UTC](https://www.ruby-forum.com/t/apache-fastcgi-working-dir-problem/133664/3 "2008-04-02T14:41:23Z")

</div>

I solved the working dir problem by not require’ing ‘lib/mylib’ but  
simply ‘mylib’ instead.  
But I still need help with the file upload problem.

Erik

---

<div class="post-metadata">

**Author:** ![seeah](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b19c9b/32.png) [@seeah](https://www.ruby-forum.com/u/seeah)\
**Post date:** [April 11, 2008, 8:33am UTC](https://www.ruby-forum.com/t/apache-fastcgi-working-dir-problem/133664/4 "2008-04-11T08:33:54Z")

</div>

Hey… I had the same problem with uploads… I try to solve it for  
the last 2 days, without result ☹  
Did you solve it???

Regards  
engineer
