Error installing Rails/FastCGI/Apache2

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

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!

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/ – DST-aware timezone library for Ruby

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

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
$ 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…

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…

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

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
$ 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