PassMark Logo
Home » Forum


No announcement yet.

Win CGI script failing on Apache 2 server

  • Filter
  • Time
  • Show
Clear All
new posts

  • Win CGI script failing on Apache 2 server


    I've read a couple of posts and the FAQ for CGI scripts, however, whenever Apache is mentioned it is automatically assumed you are on a linux box.

    I'm pointing to an internal web server (Win 2003 Server, SP2) cgi-bin folder where the Zoom application automatically stores the search.cgi application (vs. ftp).

    http://intranet/cgi-bin/search.cgi returns:
    <title>500 Internal Server Error</title>
    <h1>Internal Server Error</h1>
    <p>The server encountered an internal error or
    misconfiguration and was unable to complete
    your request.</p>
    <p>Please contact the server administrator,
     webmaster@domain.tld and inform them of the time the error occurred,
    and anything you might have done that may have
    caused the error.</p>
    <p>More information about this error may be available
    in the server error log.</p>
    <address>Apache/2.2.4 (Win32) Server at intranet Port 80</address>
    First I'm surprised at the error because the default cgi-bin/ works just fine. Second, it seems odd that the html code is posted in the window vs. actually rendering to see only text.

    I've tried to work around this by using the php function passthru() which does open the search box correctly, however, this page is embedded in a CMS (Joomla 1.5RC) and to call this page there are some $_GET[''] variables that are not being captured (intranet/index.php?option=com_zoom&Itemid=64).

    PHP Code:
    passthru ($command);
    $results ob_get_contents();
    //echo JText::_($results);
    echo JText::_(ereg_replace("Content-type: text/html;"""$results)); 
    Best results is to figure out how to post the CMS variables within the passthru() function, but if that doesn't work... I need to get cgi-bin/search.cgi displaying correctly so I can create an iframe.

    thanks for the help,

    - MusOX

  • #2
    Error 500 is a very general error generate by web server to indicate some type of failure. But it so general that there are dozens of different issues that can cause it.

    The Zoom CGI is a binary executable CGI. Not a Perl script. So being able to run a Perl script like, doesn't prove much. Many people confuse Perl and CGI, they are not the same thing. CGI is an interface definition, Perl is a programming language.

    So maybe your Apache configuration is trying to execute search.cgi as if it was a Perl script. This would cause an error. Other common CGI problems are covered in the FAQ for CGI issues. Many of the issues in that FAQ cover Windows installations, not just Linux.


    • #3
      I'm not sure what part of my httpd config file is incorrect. It seems I have everything in place. In my httpd.conf file:

      LoadModule cgi_module modules/ (without "#" in front)
      <IfModule alias_module>
      ScriptAlias /cgi-bin/ "d:/wamp/Apache2/cgi-bin/"
      <Directory "d:/wamp/apache2/cgi-bin">
      	AllowOverride None
      	#Options None
      	Options +ExecCGI
      	ScriptInterpreterSource registry
      	Addhandler cgi-script .cgi
      	Order allow,deny
      	Allow from all
      <IfModule mime_module>
      AddHandler cgi-script .cgi


      • #4
        I would still preferr the passthru() function. How can I add the "option=com_zoom&Itemid=64" so the page displays correctly when clicking on "Search"?

        - MusOX


        • #5
          It might be the "ScriptInterpreterSource registry" line in your configuration. I am fairly sure that this is not a default Apache setting.

          This directive is used to control how Apache finds the interpreter used to run CGI scripts. The default technique is to use the interpreter pointed to by the #! line in the script. Setting ScriptInterpreterSource registry will cause the Windows Registry to be searched using the script file extension (e.g., .pl) as a search key.

          You might find that .CGI is not defined in the Windows registry. And further find that this ScriptInterpreterSource line is not required?

          I am not familiar with the Joomla product, nor really with the PHP passthru command. So I am not exactly sure where your parameter should be 'added', not what effect it would have if it was added. Are you just trying to add it on to the Zoom query string? We tried to write a FAQ on using Zoom and Joomla but Joomla can be configured in so many ways giving any sensible instructions was hard.

          If your site wasn't an internal private site we could have a closer look at it.


          • #6
            Thanks for the reply,

            I dug a little deeper into the cgi faq, and change the script name from .cgi to .exe, reindexed the files and I'm now able to us an iframe. This is my second choice for searching via zoom, but at least I have it working.

            As for the php passsthru command, the joomla values must be first so joomla can generate the page which points to the zoom passthru command.

            Again, thanks for the help!

            - MusOX


            • #7
              In your httpd.conf, shouldn't that be:

              Options ExecCGI

              rather than

              Options +ExecCGI

              It worked for me.