PERL Execution

I'm running Sun Java Systems Web Server 7.0 with Coldfusion 7.0 and Perl 5.6 on a Win2003 Server.

I've got everything running, finally. The issue I'm running into is that when a perl script is called, it executes, but any associated files such as templates cannot be found. If I modify the code to include the fully qualified directory path (i.e. d:/mywebserver/doc_root/folder/file) to the template, it works fine.

I have set the folder permissions to full access for everyone (execute scripts and executables). File associations are all correct. I'm sure it has something to do with the web server.

Does anyone have any insight into this dilemma.

Thanks,

[691 byte] By [tbugler_01a] at [2007-11-27 9:08:36]
# 1
can you elaborate more as to what you mean by template ? an example might be great
chilidevelopera at 2007-7-12 21:47:04 > top of Java-index,Web & Directory Servers,Web Servers...
# 2

The perl file is calling an html template page; in this case it is a perl form and the variables are displayed in the html form. Other perl pages are calling custom library objects, which are not found.

Essentially what is happening is the perl file is being executed in the perl/bin directory as opposed to the webserver directory, as such an references to support files crap out.

example code snippet:

- --

use strict;

use CGI ":standard";

my $templateFile = "vbbrequest.html";

(NOTE: template is in the same directory as the perl file)

my @month= qw/ January February March April May June July August September October November December /;

my @monthMax= qw/ 31 28 31 30 31 30 31 31 30 31 30 31 /;

my @weekday= qw/ Sunday Monday Tuesday Wednesday Thursday Friday Saturday /;

my @template= ();

my $timestamp= time;

my $humanTime= localtime $timestamp;

my $deadline= 12;

#grab server date attributes

my ($sec, $min, $hour, $day, $mon, $year, $wday, $yday, $isdst) = localtime $timestamp;

$year += 1900;

#check for leap year to adjust $monthMax[1] as necessary

my $leapCheck = $year % 4; if ($leapCheck == 0) { $monthMax[1] += 1; }

my $thDay= &dayeth;

sub getTemplate {

open (TEMPLATE, $templateFile) or die

print "ERROR: Could not open TEMPLATE: $_ ($!)";

(This is where it fails - no such file or directory error)

@template = <TEMPLATE>;

close (TEMPLATE);

} #eofn: getTemplate

- -

Inserted some test code to display the contents of the directory upon execution and it displays the contents of the perl/bin/ directory.

So my thinking it has to have something to do with either execution permissions or a system / web server mapping.

tbugler_01a at 2007-7-12 21:47:04 > top of Java-index,Web & Directory Servers,Web Servers...
# 3

It looks like Web Server 7.0 sets the current directory to the directory that contains the interpreter (e.g. Perl.exe), not the directory that contains the script. I think that's a bug in Web Server 7.0's Windows shell CGI support. I've filed a Sun bug report, CR 6575279. Hopefully it will be addressed in a 7.0 update release.

If you have a support contract with Sun, I think you should call them up. They should be able to get you a fix.

As a work around, you could locate the send-shellcgi line in the obj.conf configuration file and specify which directory to use with the dir parameter. It sounds like you want the following:

Service fn="send-shellcgi" ... dir="$path/.."

elvinga at 2007-7-12 21:47:04 > top of Java-index,Web & Directory Servers,Web Servers...
# 4
Thanks for the info - I'll give it a try and let you know.
tbugler_01a at 2007-7-12 21:47:04 > top of Java-index,Web & Directory Servers,Web Servers...
# 5
Sorry it took me so long to get back - I was on vacation.I tried adding the directory, but to no avail. Any other ideas?
tbugler_01a at 2007-7-12 21:47:04 > top of Java-index,Web & Directory Servers,Web Servers...
# 6
Adding dir="$path/.." works for me. If it doesn't work for you, can you share your configuration files, access logs, and the output of a CGI script that prints the current directory.Message was edited by: elving
elvinga at 2007-7-12 21:47:04 > top of Java-index,Web & Directory Servers,Web Servers...
# 7

obj.conf file

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

<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" dir="$path/.."

</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>

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

<vs>_obj.conf file

<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" dir="$path/.."

</Object>

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

server log error

warning for host xxx.xxx.xxx.xxx trying to GET /folder/folder/file.pl, C:\Perl\bin\perl.exe reports: CORE4385: stderr: 1 at c:/webserver7/https-vs/docs//folder/folder/file.pl line 40.

line 40 is the call to the template.

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

Access Log

09/Jul/2007:14:18:58 "GET /its/vbbrequest/vbbrequest.pl HTTP/1.1" 200 76

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

output of current directory:

Dir Contents

a2p.exe

c2ph.bat

config.pl

configPPM.pl

crc32

crc32.bat

decode-base64

decode-base64.bat

decode-qp

decode-qp.bat

dprofpp.bat

encode-base64

encode-base64.bat

encode-qp

encode-qp.bat

exetype.bat

find2perl.bat

GET

GET.bat

h2ph.bat

h2xs.bat

HEAD

HEAD.bat

IISScriptMap.pl

libnetcfg.bat

libnetcfg.pl

lwp-download

lwp-download.bat

lwp-mirror

lwp-mirror.bat

lwp-request

lwp-request.bat

lwp-rget

lwp-rget.bat

perl.exe

perl5.6.1.exe

perl56.dll

perlbug.bat

perlcc.bat

perldoc.bat

PerlEz.dll

perlglob.bat

perlglob.exe

perlis.dll

PerlMsg.dll

PerlSE.dll

pl2bat.bat

pl2pm.bat

pod2html.bat

pod2latex.bat

pod2man.bat

pod2text.bat

pod2usage.bat

podchecker.bat

podselect.bat

POST

POST.bat

ppm.bat

ppm2.bat

ppm3-bin

ppm3-bin.bat

ppm3-bin.cfg

ppm3.bat

pstruct.bat

ptked

ptked.bat

ptksh

ptksh.bat

reloc_perl

reloc_perl.bat

runperl.bat

s2p.bat

search.bat

SOAPsh.bat

SOAPsh.pl

splain.bat

stubmaker.bat

stubmaker.pl

widget

widget.bat

wperl.exe

XMLRPCsh.bat

XMLRPCsh.pl

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

Error Message;

Could not open TEMPLATE: vbbrequest.html (No such file or directory)

Hope this helps.

tbugler_01a at 2007-7-12 21:47:04 > top of Java-index,Web & Directory Servers,Web Servers...
# 8
Make sure to add dir="$path/.." to all your send-shellcgi directives.
elvinga at 2007-7-12 21:47:04 > top of Java-index,Web & Directory Servers,Web Servers...
# 9
My Bad... work perfectly now - thanks!
tbugler_01a at 2007-7-12 21:47:04 > top of Java-index,Web & Directory Servers,Web Servers...