# Error installing Rails/FastCGI/Apache2

**URL:** <https://www.ruby-forum.com/t/error-installing-rails-fastcgi-apache2/52960>\
**Category:** Rails\
**Created:** [January 21, 2006, 3:40pm UTC](https://www.ruby-forum.com/t/error-installing-rails-fastcgi-apache2/52960 "2006-01-21T15:40:03Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [January 21, 2006, 3:40pm UTC](https://www.ruby-forum.com/t/error-installing-rails-fastcgi-apache2/52960/1 "2006-01-21T15:40:03Z")

</div>

Trying to install rails/fcgi/apache2. Following these instructions:

[http://xmlareas.com/ruby-rails-howto.html](http://xmlareas.com/ruby-rails-howto.html)

Using Fedora Core 4. I installed ruby and ruby-devel using apt-get.  
Everything under Adding FastCGI (optional) works fine up to the gem  
install  
fcgi part. Here is what happens:

[root@paulbarry fcgi-2.4.0]# gem install fcgi -r –  
-with-fcgi-lib=/usr/local/fcgi/lib  
–with-fcgi-include=/usr/local/fcgi/include  
Attempting remote installation of ‘fcgi’  
Building native extensions. This could take a while…  
\*\*\* extconf.rb failed \*\*\*  
Could not create Makefile due to some reason, probably lack of  
necessary libraries and/or headers. Check the mkmf.log file for more  
details. You may need configuration options.

Provided configuration options:  
–with-opt-dir  
–without-opt-dir  
–with-opt-include  
–without-opt-include=${opt-dir}/include  
–with-opt-lib  
–without-opt-lib=${opt-dir}/lib  
–with-make-prog  
–without-make-prog  
–srcdir=.  
–curdir  
–ruby=/usr/bin/ruby  
–with-fcgi-dir  
–without-fcgi-dir  
–with-fcgi-include=${fcgi-dir}/include  
–with-fcgi-lib  
–without-fcgi-lib=${fcgi-dir}/lib  
–with-fcgilib  
–without-fcgilib  
ERROR: While executing gem … (RuntimeError)  
ERROR: Failed to build gem native extension.  
Gem files will remain installed in  
/usr/lib/ruby/gems/1.8/gems/fcgi-0.8.6.1for inspection.  
ruby extconf.rb install fcgi -r – -with-fcgi-lib=/usr/local/fcgi/lib  
–with-fcgi-include=/usr/local/fcgi/include\nchecking for fcgiapp.h…  
yes  
checking for FCGX\_Accept() in -lfcgi… no

Here’s what mkmf.log has to say:

[root@paulbarry fcgi-2.4.0]# cat /usr/lib/ruby/gems/1.8/gems/fcgi-  
0.8.6.1/ext/mkmf.log  
have\_header: checking for fcgiapp.h… -------------------- yes

“i386-redhat-linux-gcc -E -I. -I/usr/lib/ruby/1.8/i386-linux  
-I/usr/local/fcgi/include -O0 -g -pipe -Wp,-D\_FORTIFY\_SOURCE=2  
-fexceptions  
-m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables -Wall  
-fPIC  
conftest.c -o conftest.i”  
checked program was:  
/\* begin _/  
 #include \<fcgiapp.h\>  
/_ end \*/

* * *

## have\_library: checking for FCGX\_Accept() in -lfcgi…

no

“i386-redhat-linux-gcc -o conftest -I. -I/usr/lib/ruby/1.8/i386-linux  
-I/usr/local/fcgi/include -O0 -g -pipe -Wp,-D\_FORTIFY\_SOURCE=2  
-fexceptions  
-m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables -Wall  
-fPIC  
conftest.c -L”/usr/lib" -lruby-static -lfcgi -ldl -lcrypt -lm  
-lc"  
conftest.c: In function ‘t’:  
conftest.c:4: warning: implicit declaration of function ‘FCGX\_Accept’  
/usr/bin/ld: cannot find -lfcgi  
collect2: ld returned 1 exit status  
checked program was:  
/\* begin \*/

/_top_/  
int main() { return 0; }  
int t() { FCGX\_Accept(); return 0; }  
/\* end \*/

“i386-redhat-linux-gcc -o conftest -I. -I/usr/lib/ruby/1.8/i386-linux  
-I/usr/local/fcgi/include -O0 -g -pipe -Wp,-D\_FORTIFY\_SOURCE=2  
-fexceptions  
-m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables -Wall  
-fPIC  
conftest.c -L”/usr/lib" -lruby-static -lfcgi -ldl -lcrypt -lm  
-lc"  
conftest.c: In function ‘t’:  
conftest.c:5: error: ‘FCGX\_Accept’ undeclared (first use in this  
function)  
conftest.c:5: error: (Each undeclared identifier is reported only once  
conftest.c:5: error: for each function it appears in.)  
checked program was:  
/\* begin \*/

/_top_/  
int main() { return 0; }  
int t() { void ((_volatile p)()); p = (void ((_)()))FCGX\_Accept; return  
0; }  
/\* end \*/

* * *

Help!

---

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [January 21, 2006, 3:40pm UTC](https://www.ruby-forum.com/t/error-installing-rails-fastcgi-apache2/52960/2 "2006-01-21T15:40:23Z")

</div>

Paul B. wrote:

> –with-fcgi-include=/usr/local/fcgi/include  
> Looks like you’re missing a hyphen in the with-fcgi-lib option. It  
> should be

gem install fcgi -r – --with-fcgi-lib=/usr/local/fcgi/lib  
–with-fcgi-include=/usr/local/fcgi/include

Phil

–  
Philip R.  
[http://tzinfo.rubyforge.org/](http://tzinfo.rubyforge.org/) – DST-aware timezone library for Ruby

---

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [January 21, 2006, 3:40pm UTC](https://www.ruby-forum.com/t/error-installing-rails-fastcgi-apache2/52960/3 "2006-01-21T15:40:23Z")

</div>

Did you install the fast CGI development libraries? If so, what path  
are  
they located in? Is this path in your LD\_LIBRARY\_PATH, or in your  
/etc/ld.so.conf file? If you added the appropriate path to your  
ld.so.conffile, did you run ldconfig afterwards?

-Will

---

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [January 21, 2006, 3:40pm UTC](https://www.ruby-forum.com/t/error-installing-rails-fastcgi-apache2/52960/4 "2006-01-21T15:40:25Z")

</div>

I started over with this method, which I had more success with:

$ tar zxvf fcgi-2.4.0.tar.gz  
$ cd fcgi-2.4.0  
$ ./configure  
$ make  
$ make install  
$ gem install fcgi  
$ wget [http://www.wesmo.com/redhat/i386/mod\_fastcgi-2.4.2-1.i386.rpm](http://www.wesmo.com/redhat/i386/mod_fastcgi-2.4.2-1.i386.rpm)  
$ rpm -ivh mod\_fastcgi-2.4.2-1.i386.rpm

That got fastcgi and mo\_fastcgi installed. I added this to my  
httpd.conf:

LoadModule fastcgi\_module modules/mod\_fastcgi.so

 FastCgiIpcDir /tmp/fcgi\_ipc FastCgiServer /home/paulbarry/public/dispatch.fcgi \ -initial-env RAILS\_ENV=development \ -idle-timeout 60

And I set the set the permissions on /tmp/fcgi\_ipc:

$ mkdir /tmp/fcgi\_ipc  
$ chown apache.apache /tmp/fcgi\_ipc -R  
$ chmod 755 /tmp/fcgi\_ipc -R  
$ ls -l /tmp  
drwxr-xr-x 2 apache apache 4096 Jan 14 16:19 fcgi\_ipc

When I start apache, I get this error:

$ /etc/init.d/httpd start  
Starting httpd: Syntax error on line 195 of /etc/httpd/conf/httpd.conf:  
FastCgiIpcDir /tmp/fcgi\_ipc: access for server (uid -1, gid -1) failed:  
write not allowed  
[FAILED]

Any ideas as to what is causing that error? In the meantime I think it  
is  
time to give lightty a try…

---

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [April 4, 2006, 5:25pm UTC](https://www.ruby-forum.com/t/error-installing-rails-fastcgi-apache2/52960/5 "2006-04-04T17:25:43Z")

</div>

I couldn’t get the fcgi to work unless I gave /tmp/fcgi\_ipc AND  
/tmp/fcgi\_ipc/dynamic 777.

Wes

Paul B. wrote:

> FastCgiIpcDir /tmp/fcgi\_ipc  
> FastCgiServer /home/paulbarry/public/dispatch.fcgi   
> -initial-env RAILS\_ENV=development   
> -idle-timeout 60
> 
> And I set the set the permissions on /tmp/fcgi\_ipc:
> 
> $ mkdir /tmp/fcgi\_ipc  
> $ chown apache.apache /tmp/fcgi\_ipc -R  
> $ chmod 755 /tmp/fcgi\_ipc -R  
> $ ls -l /tmp  
> drwxr-xr-x 2 apache apache 4096 Jan 14 16:19 fcgi\_ipc
> 
> When I start apache, I get this error:
> 
> $ /etc/init.d/httpd start  
> Starting httpd: Syntax error on line 195 of /etc/httpd/conf/httpd.conf:  
> FastCgiIpcDir /tmp/fcgi\_ipc: access for server (uid -1, gid -1) failed:  
> write not allowed  
> [FAILED]
> 
> Any ideas as to what is causing that error? In the meantime I think it  
> is  
> time to give lightty a try…

---

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [April 4, 2006, 6:22pm UTC](https://www.ruby-forum.com/t/error-installing-rails-fastcgi-apache2/52960/6 "2006-04-04T18:22:26Z")

</div>

Paul B. wrote:

> That got fastcgi and mo\_fastcgi installed. I added this to my  
> httpd.conf:
> 
> LoadModule fastcgi\_module modules/mod\_fastcgi.so

If you use Apache 2.x, use mod\_fcgid instead of mod\_fastcgi.

This is noted in the rails FAQ.

[http://wiki.rubyonrails.com/rails/pages/FAQ](http://wiki.rubyonrails.com/rails/pages/FAQ)

---

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [February 19, 2007, 10:53pm UTC](https://www.ruby-forum.com/t/error-installing-rails-fastcgi-apache2/52960/7 "2007-02-19T22:53:03Z")

</div>

Paul B. wrote:

> I started over with this method, which I had more success with:
> 
> $ tar zxvf fcgi-2.4.0.tar.gz  
> $ cd fcgi-2.4.0  
> $ ./configure  
> $ make  
> $ make install  
> $ gem install fcgi  
> $ wget [http://www.wesmo.com/redhat/i386/mod\_fastcgi-2.4.2-1.i386.rpm](http://www.wesmo.com/redhat/i386/mod_fastcgi-2.4.2-1.i386.rpm)  
> $ rpm -ivh mod\_fastcgi-2.4.2-1.i386.rpm
> 
> That got fastcgi and mo\_fastcgi installed. I added this to my  
> httpd.conf:
> 
> LoadModule fastcgi\_module modules/mod\_fastcgi.so
> 
> FastCgiIpcDir /tmp/fcgi\_ipc FastCgiServer /home/paulbarry/public/dispatch.fcgi \ -initial-env RAILS\_ENV=development \ -idle-timeout 60
> 
> And I set the set the permissions on /tmp/fcgi\_ipc:
> 
> $ mkdir /tmp/fcgi\_ipc  
> $ chown apache.apache /tmp/fcgi\_ipc -R  
> $ chmod 755 /tmp/fcgi\_ipc -R  
> $ ls -l /tmp  
> drwxr-xr-x 2 apache apache 4096 Jan 14 16:19 fcgi\_ipc
> 
> When I start apache, I get this error:
> 
> $ /etc/init.d/httpd start  
> Starting httpd: Syntax error on line 195 of /etc/httpd/conf/httpd.conf:  
> FastCgiIpcDir /tmp/fcgi\_ipc: access for server (uid -1, gid -1) failed:  
> write not allowed  
> [FAILED]
> 
> Any ideas as to what is causing that error? In the meantime I think it  
> is  
> time to give lightty a try…

Hi, the problem is that apache server isn’t allowed to read that  
directory

this is not user and group

this is how your apache configure in httpd.conf

you need to add something like  
\<Directory /tmp/fcgi\_ipc\>  
Allow from all
