Gossamer Forum
Home : General : Perl Programming :

Wierd CGI header error

Quote Reply
Wierd CGI header error
I'm pulling my hair out so any help is very much appreciated. Here's the scenario:

I have a fully functional perl CGI script that connects to a MySQL database, using DBI, which outputs a list of all records found. (Extremely bare-bones) When I call this script with a web browser it outputs all records as expected. When I run it locally from a command prompt, it also works fine. Here's the catch. When I modify the statement to connect to an Access database, and not the MySQL, using an ODBC driver, I get an error in my browser that says : CGI Error

The specified CGI application misbehaved by not returning a complete set of HTTP headers.



If I run the .cgi script from a DOS prompt, though, everything looks fine. I get the proper "Content-type: text/html" header, and all records are returned as they should be. Bear in my mind, I haven't changed the rest of the script at all from the original. Why would the script work from the DOS prompt, but not when loaded in a browser? Below is the ONLY modification made in my script:



This one works (MySQL)

$dbh = DBI-> connect ("DBI:mysql:host=localhost;database=cars", "Maintenance", "password",{PrintError => 0, RaiseError => 1});



This one does not (Access-ODBC)


$dbh = DBI-> connect ("DBI:ODBC:CarData", {PrintError => 0, RaiseError => 1});



I think that some kind of error is kicking out before the header is output to the web, but this error doesn't happen when run locally. The printout looks PERFECT in a DOS window so I don't get why it's bombing out through a browser. I am running IIS 6.0 with the latest installation of ActivePerl from ActiveState. Please let me know if you need any further info at all. Thanks SOOOOOOO much for any help.

--Seth
Quote Reply
Re: [seth_h] Wierd CGI header error In reply to
Can you make change like this and see what wrong?

$dbh = DBI-> connect ("DBI:ODBC:CarData", {PrintError => 1, RaiseError => 1});

Cheers,

Dat

Programming and creating plugins and templates
Blog
Quote Reply
Re: [tandat] Wierd CGI header error In reply to
When I do that I get the following error. Any idea why?

C:\cgi-bin>perl returnauction.cgi
[Fri Dec 19 12:30:16 2003] returnauction.cgi: Can't modify constant item in scal
ar assignment at returnauction.cgi line 7, near ");"
[Fri Dec 19 12:30:16 2003] returnauction.cgi: Execution of returnauction.cgi abo
rted due to compilation errors.

C:\cgi-bin>

Thanks again for your help.

--Seth
Quote Reply
Re: [seth_h] Wierd CGI header error In reply to
  
$dbh = DBI-> connect ("DBI:ODBC:CarData", "Username","Password",{PrintError => 1, RaiseError => 1});


Cheers,

Cheers,

Dat

Programming and creating plugins and templates
Blog

Last edited by:

tandat: Dec 19, 2003, 10:07 PM