You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "S. M. Halloran" <Mi...@ankara.edu.tr> on 2005/11/04 13:16:25 UTC

[users@httpd] Neophyte Query: No (Std) Output from CGI scripts: Defective Setup?

1. OS info:   MS Windows XP Professional version 2002 SP1
   CLI: Microsoft Windows XP [Version 5.1.2600]
2. HTTP Server info:  Apache/2.0.53 (Win32)
3. Hardware:  Pentium-M 1.6 GHz, 512 MB ram
4. (Possibly) Relevant Directives in httpd.conf:
    DocumentRoot "C:/Documents and Settings/SMH/My Documents/___WebMirror"
    ScriptAlias /cgi-bin/ "C:/Documents and Settings/SMH/My Documents/___WebMirror/cgi-bin/" #added
    <Directory "C:/Documents and Settings/SMH/My Documents/___WebMirror/cgi-bin">  #added
      AllowOverride None
      Options None
      Order allow,deny
      Allow from all
    </Directory>
    AddHandler cscript .wsf      # added
    ScriptLog "C:/Documents and Settings/SMH/My Documents/___WebMirror/cgi-bin/ScriptLog.txt"
    ScriptInterpreterSource Registry  # added
    <IfModule mpm_winnt.c>
     ThreadsPerChild 50          # changed from original 250
     MaxRequestsPerChild  0
    </IfModule>
--------------------------------------------------------------

I am setting up an Apache server on my laptop only for testing programs 
and setup.  Working stuff will be migrated to a public server.

I am testing the communication between Apache and simple scripting 
routines and getting 500 responses.

At first the server would call a Windows Script Host file (wsf) and 
merely output the entire contents of the wsf file.  Access log reports a 
200 response on delivering the wsf file and then immediately making a 404 
response to attempting to deliver a 'favicon.ico' file from the root dir, 
even though no code whatsoever makes a reference to that file.   The 
Error log only reports the 404.

The absence of a ScriptLog file suggested that the server was not 
starting the script interpreter, even though files of type .wsf are 
defined in the OS (in the registry) and the interpreter ("handler") was 
also defined (although without options) in the httpd.conf (is there a way 
for Apache to pass command line options, or a way to instruct the server 
how to format a command line?).

A MSDOS batch (.bat) file was created to explicitly call the wsf file 
with options.  From within the wsf file a JavaScript (JScript) file is 
included/loaded.  This does happen:  when the js file contains nonsense 
(such as attempts to use objects that don't exist like 'window' or 
'document' within the js file), the MS script debugger window opens and 
requests a debugging session.

When I run aubidb.bat from a command line, I get the expected output:

====
C:\Documents and Settings\SMH\My Documents\___WebMirror\cgi-bin>aubidb.bat
Content-type: text/plain


This output generated from within 'aubidb.js' using WScript.Echo()
Job complete

C:\Documents and Settings\SMH\My Documents\___WebMirror\cgi-bin>
====

I have run through the checklist of the problems in the Apache manual and 
still do not know why this output above is being shown on the browser's 
output area, but is instead giving 500 responses.


=============================================================
Contents of wsf file (aubidb.wsf):
---------------------------------
<?xml version="1.0" standalone="yes" ?>

<job >
 <runtime>
  <description>Test script to check input and output</description>
  <unnamed
   name="url"
   helpstring="properly formatted url string"
   many="false"
   required="true"
  />
  <example>this script started by http server</example>
 </runtime>
 <?job error="true" debug="true"?>
 <script language="JScript">
   WScript.Echo("Content-type: text/plain\n\n");
 </script>
 <script language="JScript" src="aubidb.js" />
</job>
=============================================================
Contents of js file (aubidb.js):
---------------------------------
WScript.Echo("This output generated from within 'aubidb.js' using WScript.Echo()");
=============================================================
Contents of bat file (aubidb.bat):
---------------------------------
@echo off
cscript aubidb.wsf //nologo
=============================================================


--
S M Halloran
AUBI