in reply to Re^2: Bad File Descriptor
in thread Bad File Descriptor

I had read that Windows does not require a Shebang line, but, while that was apparently true when I was running Apache 1.3 on a Windows 2003 Server it isn't the case with Apache 2.2 on Windows Server 2012, at least not the way my instances are or aren't configured.

Windows does not require a shebang line, but Apache does if configured that way. ScriptInterpreterSource set to Script requires a shebang line, set to Registry uses the default Windows mechanism, set to Registry-Strict reads the registry subkey Shell\ExecCGI\Command. Script is the default since the directive was introduced (in 1.3.6, according to apacheweek). Before that, the Apache behaviour was equivalent to Registry.

If the old Apache was configured to use mod_perl and Apache::Registry, Apache would not care about the Windows registry or the shebang line, but instead use the perl interpreter running in mod_perl.

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Replies are listed 'Best First'.
Re^4: Bad File Descriptor
by Milti (Beadle) on Oct 03, 2016 at 16:22 UTC

    Thanks! I think you nailed the best solution to the problem. I added "ScriptInterpreterSource Registry' to the HTTPD Config file and everything seems to work.

      Consider using Registry-Strict instead.

      Registry uses the default mechanism used to "start" or "open" a file, whereas Registry-Strict requires that you explicitly add a (very simple) registry entry explaining Apache how to "start-as-a-CGI" a file (see ScriptInterpreterSource). The difference is not obvious, but it prevents Apache from trying to open files not meant to be executed as CGIs.

      As long as your CGI directory just contains CGIs, there is no difference. But if you accidentally leave a *.txt or *.doc file there and issue a HTTP request for the file, Apache in Registry mode will blindly attempt to start Notepad or Wordpad/Word as a CGI, whereas Apache in Registry-Strict mode won't (and report an error instead).

      I know from experience that at least Windows NT and 2000 will make Notepad / Wordpad / Word hang when started from the Apache service. My guess is that the executable attempts to open a window, but as services generally are not allowed to interact with a Desktop, they get stuck somehow. I haven't checked a more modern Windows, but I guess the behaviour did not change.

      Alexander

      --
      Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
        iirc, that depends on the settings you use ... even in cgi-bin you can say only execute *.pl or *.cgi instead of all files