Skip to Content
0
Apr 07, 2010 at 07:29 PM

Perl sapnwrfc: using it with Apache

64 Views

Thanks to I'm now making fine progress in getting perl to interact with my SAP system using sapnwrfc. However, I want to also write some scripts using CGI perl (or mod_perl) with Apache. I am avoiding using PHP because we already have other admins who are using Perl for other things.

I'm having problems getting the script to run under Apache. It runs fine from a command-prompt.

I first ran into LD_LIBRARY_PATH problems so that the library wasn't found. I fixed that so that I am now getting the modules to load (and the nwrfc libraries) but all I get when I run the script from my browser is the following in my error_log:

[Wed Apr 07 14:09:41 2010] [error] [client XXX.XXX.XXX.XXX] terminate called after throwing an instance of '
[Wed Apr 07 14:09:41 2010] [error] [client XXX.XXX.XXX.XXX] RfcInvalidParameterException
[Wed Apr 07 14:09:41 2010] [error] [client XXX.XXX.XXX.XXX] '
[Wed Apr 07 14:09:41 2010] [error] [client XXX.XXX.XXX.XXX] Premature end of script headers: rfcdest.cgi

My code is:

 
#!/usr/bin/perl

use lib qw(/usr/local/lib/perl5/ /usr/local/lib/perl5/site_perl);
use CGI qw /:standard/;
use strict;
use sapnwrfc;
use Getopt::Std;
use Data::Dumper;


print header();
print "testing4\n";
exit;

I know it is related to sapnwrfc because when I comment out the line

 
# use sapnwrfc;

the script works fine from my browser AND the command-line.

Can anyone help me with this? Has anyone else built sapnwrfc Perl scripts to run under Apache?