Apache+FastCGI working dir problem

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.

Erik Allik

I did a check on Apache access.log and error.log and Rails's own /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?


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.


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