Forum: Ruby CGI with DBI error - cant use both at the same time

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
20f6bbf518ce68b66fdc2c9126e91601?d=identicon&s=25 Gale CC (galecho)
on 2007-07-04 12:55

I'm using Ruby's CGI to handle some forms, and the form input is to be
further used to query a database. But I'm getting errors when I try to
use the DBI module to connect to the database. Even just typing
"require 'dbi'" is screwing up things. For instance in the following
code, nothing would show up unless I remove "require  'dbi'".

#!/usr/local/bin/ruby -w
print "Content-type: text/plain\n\n"
require "cgi"
require "dbi"

puts "Thanks- form submitted"

If instead of using the print command, I try to use cgi.out then I get
"500 Internal Server Error". Does anyone know a fix to this problem ?

20f6bbf518ce68b66fdc2c9126e91601?d=identicon&s=25 Gale CC (galecho)
on 2007-07-06 00:07
Any idea how to fix this, folks ?

1c0cd550766a3ee3e4a9c495926e4603?d=identicon&s=25 John Joyce (Guest)
on 2007-07-06 03:40
(Received via mailing list)
On Jul 4, 2007, at 5:55 AM, Gale CC wrote:

> require "cgi"
> --
> Posted via
move the cgi out statement below the require cgi statement
This topic is locked and can not be replied to.