trouble with fcgi and cgi

T

Tiggerius

I'm having a real difficult time trying to deploy rails demo app depot
on fedore core 4 clone centos-4.1. Please help.

I've installed ruby 1.8.3, gems 0.8.11, fcgi, mod_fastcgi, gem install
fcgi. set rails /log , /public, and /tmp/fcgi_ipc to 777. Tried
everything I know, just can't get it to work.

Problems:
------------
* on the same machine, app in webbrick runs fine.
* when using fastcgi, in httpd error log, i get:
FastCGI: can't start server "/var/www/html/proj/public/dispatch.fcgi"
(pid 4644), execle() failed: No such file or directory

* when using cgi, in rails log/Server.log, i get:
Exec format error: exec of '/var/www/html/proj/public/dispatch.cgi'
failed
Premature end of script headers: dispatch.cgi


config files list below

dispatch.fcgi
----------------------
#!/usr/local/bin/ruby
require File.dirname(__FILE__) + "/../config/environment"
require 'fcgi_handler'
RailsFCGIHandler.process!


dispatch.cgi
----------------------
#!/usr/local/bin/ruby


require File.dirname(__FILE__) + "/../config/environment" unless
defined?(RAILS_ROOT)



# If you're using RubyGems and mod_ruby, this require should be changed
to an absolute path one, like:

# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" --
otherwise performance is severely impaired

require "dispatcher"



ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if
File.directory?(dir) } if defined?(Apache::RubyRun)

Dispatcher.dispatch


httpd.conf
------------------------------------------------
User apache
Group apache

LoadModule fastcgi_module modules/mod_fastcgi.so

<IfModule mod_fastcgi.c>
FastCgiIpcDir /tmp/fcgi_ipc
AddHandler fastcgi-script .fcgi
</IfModule>

<VirtualHost *:80>
ServerName server
DocumentRoot /var/www/html/proj/public/
ErrorLog /var/www/html/proj/log/server.log

<Directory /var/www/html/proj/public/>
Options ExecCGI FollowSymLinks
AddHandler cgi-script .cgi
AddHandler fastcgi-script .fcgi
AllowOverride all
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
 
T

Tiggerius

when I run dispatch.(f)cgi from shell, both give error:
: bad interpreter: No such file or directory

but when I run "/usr/local/bin/ruby --version", it runs and returns
"ruby 1.8.3 (2005-09-21) [i686-linux]"

what's going on?




dispatch.cgi
--------------
#!/usr/local/bin/ruby



require File.dirname(__FILE__) + "/../config/environment" unless
defined?(RAILS_ROOT)



# If you're using RubyGems and mod_ruby, this require should be changed
to an absolute path one, like:

# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" --
otherwise performance is severely impaired

require "dispatcher"



ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if
File.directory?(dir) } if defined?(Apache::RubyRun)

Dispatcher.dispatch
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top