# Fcgi

**URL:** <https://www.ruby-forum.com/t/fcgi/99722>\
**Category:** Ruby\
**Created:** [July 25, 2006, 3:53am UTC](https://www.ruby-forum.com/t/fcgi/99722 "2006-07-25T03:53:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ed655f/32.png) [@tma](https://www.ruby-forum.com/u/tma)\
**Post date:** [July 25, 2006, 3:53am UTC](https://www.ruby-forum.com/t/fcgi/99722/1 "2006-07-25T03:53:09Z")

</div>

I am a little familiar with running FCGI applications and have done some  
work in  
Perl.

Under Perl I can test it easily enough by running the script from  
command line  
with STDIN/STDOUT and command line args. But this doesn’t work at all  
under ruby.

A different approach is needed.

Is there something I could do to simplify the testing/development of  
fcgi  
scripts under ruby instead of editing them in cgi-bin and trying to run  
them  
from there?

---

<div class="post-metadata">

**Author:** ![tma](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ed655f/32.png) [@tma](https://www.ruby-forum.com/u/tma)\
**Post date:** [July 25, 2006, 6:55am UTC](https://www.ruby-forum.com/t/fcgi/99722/2 "2006-07-25T06:55:08Z")

</div>

On Tue, 25 Jul 2006, Tom A. wrote:

> scripts under ruby instead of editing them in cgi-bin and trying to run them  
> from there?

??

fortytwo :/var/www/html \> cat ./env2.fcgi  
#! /usr/local/bin/ruby

require ‘rubygems’ rescue nil  
require ‘fcgi’  
require ‘yaml’

FCGI.each\_cgi{|cgi| cgi.out{ “

```
#{ cgi.env_table.to_hash.to_yaml
}
```
” }}

fortytwo :/var/www/html \> ./env2.fcgi \</dev/null | head  
Content-Type: text/html  
Content-Length: 4037

```
---
   XAUTHORITY: /home/ahoward/.Xauthority
   GS_LIB: /home/ahoward/.fonts
   SSH_ASKPASS: /usr/libexec/openssh/gnome-ssh-askpass
   KONSOLE_DCOP_SESSION: DCOPRef(konsole-4421,session-4)
   MAIL: /var/spool/mail/ahoward
   KDEDIR: /usr

hth.

-a
```
