Configure PERL/CGI on SJSWS 7.0

I'm having some real issues getting PERL functionality on SJSWS 7.0. It won't even recognize cgi. I've followed all the steps of the setup. The error is odd and the same on Win2003 Server and XP Pro:

for host xxx.xxx.xx.xxx trying to GET /cgi-bin/test.cgi, send-cgi reports: HTTP4068: cannot execute CGI script c:/webserver7/https-kings/docs/cgi-bin/test.cgi (The specified program is not a Windows executable)

Windows Server 2003 - fully updated

Sun Java System Web Server 7.0 B12/04/2006 08:46

(Have CFMX 7 running with SJSWS 7.0 as well)

I've tried using the packaged PERLas well as ActiveState PERL 5.6.x with no luck.

Any help would be greatly appreciated

[715 byte] By [tbugler_01a] at [2007-11-27 8:17:21]
# 1

I believe you have to create association for .cgi script to get executed by perl.

By default WebServer don't know how to execute .cgi on Windows. On unix

platform, loader finds the executable by first line of cgi script ( #!path to

perl )

Help for ftype will be useful. Open a command prompt (in Administrator

account).

C:> help ftype

C:> assoc .cgi=PerlScript

C:> ftype PerlScript=C:\Perl\Perl.exe %1 %*

Now test the cgi script.

C:> test.cgi

Then restart the web server. Note that association for different users can be

different so you will have to specify association for Administrator account.

Basantka at 2007-7-12 20:02:31 > top of Java-index,Web & Directory Servers,Web Servers...
# 2

In addition to the file association, you also need to create a Shell CGI directory to run the CGI programs on windows.

Use the following CLI command to create a shell CGI directory:

wadm> create-cgi-dir --config=<config> --vs=<vs_ name> --uri-prefix=<uri-prefix> --directory=<path> --shell-cgi

For more details about "Installing Shell CGI Programs for Windows", refer to the following link:

http://docs.sun.com/app/docs/doc/819-2629/6n4tgd1uc?a=view

amit-suna at 2007-7-12 20:02:31 > top of Java-index,Web & Directory Servers,Web Servers...
# 3

Hi Thanks for the replies.

I've associated .cgi and .pl to the packaged Perl. Created the CGI Shell Directory, but I'm still getting the same error.

Both .cgi and .pl execute fine in the CLI, but I get the error when I call the .pl or .cgi page through the browser.

Any ideas?

tbugler_01a at 2007-7-12 20:02:31 > top of Java-index,Web & Directory Servers,Web Servers...
# 4

Not sure if this helps, but here are the conf files:

obj.conf

========================================================

#

# Copyright 2006 Sun Microsystems, Inc. All rights reserved.

# Use is subject to license terms.

#

# You can edit this file, but comments and formatting changes

# might be lost when you use the administration GUI or CLI.

<Object name="default">

AuthTrans fn="match-browser" browser="*MSIE*" ssl-unclean-shutdown="true"

NameTrans fn="ntrans-j2ee" name="j2ee"

NameTrans fn="pfx2dir" from="/mc-icons" dir="C:/WebServer7/lib/icons" name="es-internal"

PathCheck fn="nt-uri-clean"

PathCheck fn="check-acl" acl="default"

PathCheck fn="find-pathinfo"

PathCheck fn="find-index-j2ee"

PathCheck fn=find-index index-names="index.html,home.html,index.jsp,index.cfm"

PathCheck fn="jrunfilter"

ObjectType fn=type-by-exp exp=*.jsp type="jrun-internal/ext"

ObjectType fn=type-by-exp exp=*.jws type="jrun-internal/ext"

ObjectType fn=type-by-exp exp=*.cfm type="jrun-internal/ext"

ObjectType fn=type-by-exp exp=*.cfml type="jrun-internal/ext"

ObjectType fn=type-by-exp exp=*.cfc type="jrun-internal/ext"

ObjectType fn=type-by-exp exp=*.cfr type="jrun-internal/ext"

ObjectType fn=type-by-exp exp=*.cfswf type="jrun-internal/ext"

ObjectType fn="type-j2ee"

ObjectType fn="type-by-extension"

ObjectType fn="force-type" type="text/plain"

Service method=(GET|HEAD|POST) type="jrun-internal/*" fn="jrunservice"

Service method="(GET|HEAD)" type="magnus-internal/directory" fn="index-common"

Service method="(GET|HEAD|POST)" type="*~magnus-internal/*" fn="send-file"

Service method="TRACE" fn="service-trace"

Error fn="error-j2ee"

AddLog fn="flex-log"

</Object>

<Object name="j2ee">

Service fn="service-j2ee" method="*"

</Object>

<Object name="es-internal">

PathCheck fn="check-acl" acl="es-internal"

</Object>

<Object name="shellcgi">

ObjectType fn="force-type" type="magnus-internal/shellcgi"

Service fn="send-shellcgi"

</Object>

<Object name="cgi">

ObjectType fn="force-type" type="magnus-internal/cgi"

Service fn="send-cgi"

</Object>

<Object name="send-precompressed">

PathCheck fn="find-compressed"

</Object>

<Object name="compress-on-demand">

Output fn="insert-filter" filter="http-compression"

</Object>

========================================================

instance_obj.conf

==============

# Copyright 2007 Sun Microsystems, Inc. All rights reserved.

# Use is subject to license terms.

#

# You can edit this file, but comments and formatting changes

# might be lost when you use the administration GUI or CLI.

# Use only forward slashes in pathnames as backslashes can cause

# problems. Refer to the documentation for more information.

<Object name="default">

AuthTrans fn="match-browser" browser="*MSIE*" ssl-unclean-shutdown="true"

NameTrans fn="ntrans-j2ee" name="j2ee"

NameTrans fn="pfx2dir" from="/mc-icons" dir="C:/WebServer7/lib/icons" name="es-internal"

NameTrans fn="home-page" path=""

PathCheck fn="nt-uri-clean"

PathCheck fn="check-acl" acl="default"

PathCheck fn="find-pathinfo"

PathCheck fn="find-index-j2ee"

PathCheck fn="find-index" index-names="index.cfm,index.html,home.html,index.jsp"

PathCheck fn="jrunfilter"

PathCheck fn="set-cache-control" control="public"

ObjectType fn="type-by-exp" exp="*.jsp" type="jrun-internal/ext"

ObjectType fn="type-by-exp" exp="*.jws" type="jrun-internal/ext"

ObjectType fn="type-by-exp" exp="*.cfm" type="jrun-internal/ext"

ObjectType fn="type-by-exp" exp="*.cfml" type="jrun-internal/ext"

ObjectType fn="type-by-exp" exp="*.cfc" type="jrun-internal/ext"

ObjectType fn="type-by-exp" exp="*.cfr" type="jrun-internal/ext"

ObjectType fn="type-by-exp" exp="*.cfswf" type="jrun-internal/ext"

ObjectType fn="type-j2ee"

ObjectType fn="type-by-extension"

ObjectType fn="force-type" type="text/plain"

Service method="(GET|HEAD|POST)" type="jrun-internal/*" fn="jrunservice"

Service method="(GET|HEAD)" type="magnus-internal/directory" fn="index-common"

Service fn="append-trailer" type="text/html" timefmt="%B %d, %Y %I:%M" trailer=""

Service fn="shtml-send" type="magnus-internal/parsed-html" method="(GET|HEAD)"

Service fn="send-cgi" type="magnus-internal/cgi"

Service fn="send-shellcgi" type="magnus-internal/shellcgi"

Service method="(GET|HEAD|POST)" type="*~magnus-internal/*" fn="send-file"

Service method="TRACE" fn="service-trace"

Error fn="error-j2ee"

AddLog fn="flex-log"

</Object>

<Object name="j2ee">

Service fn="service-j2ee" method="*"

</Object>

<Object name="es-internal">

PathCheck fn="check-acl" acl="es-internal"

</Object>

<Object name="cgi">

ObjectType fn="force-type" type="magnus-internal/cgi"

Service fn="send-cgi"

</Object>

<Object name="send-precompressed">

PathCheck fn="find-compressed"

</Object>

<Object name="compress-on-demand">

Output fn="insert-filter" filter="http-compression"

</Object>

<Object name="shellcgi">

ObjectType fn="force-type" type="magnus-internal/shellcgi"

Service fn="send-shellcgi"

</Object>

========================================================

tbugler_01a at 2007-7-12 20:02:31 > top of Java-index,Web & Directory Servers,Web Servers...
# 5

The <vs-id>-obj.conf is supposed to contain an entry something like the following after creating the shell CGI directory from CLI/GUI.

NameTrans fn="pfx2dir" from="/cgi-bin" dir="<dir_path>" name="shellcgi"

I can't seem to find this entry in your obj.conf.

May i know how did you create the shell CGI Directory?

Did you deploy the configuration after creating the shell CGI directory?

amit-suna at 2007-7-12 20:02:31 > top of Java-index,Web & Directory Servers,Web Servers...
# 6

I created a cgi-bin folder off the root.

Used AdminGUI to create a CGI Directory (prefix /:cgi-bin, directory c:/webserver7/https-kuc/docs/cgi-bin)

Selected the Shell CGI option.

Saved the changes.

Re-deployed - tested it and it didn't work.

Restarted the server for good measure and still didn't work.

tbugler_01a at 2007-7-12 20:02:31 > top of Java-index,Web & Directory Servers,Web Servers...
# 7
I manually added the missing line to the <vs-id>-conf.conf file and everything is working as it should.It would seem that there is a bug in the configuration and it omits the necessary shell-cgi entry.Thanks so much for your help!
tbugler_01a at 2007-7-12 20:02:31 > top of Java-index,Web & Directory Servers,Web Servers...