Trying to get perl/cgi application to run that uses CGI::Fast

Discussion in 'CGI/Perl/Python' started by hdee, Jul 3, 2012.

  1. hdee

    hdee New Member

    I'm having the hardest time figuring this out.

    At this point I'm trying to get it to just work with anything.

    I've tried setting up lsperl, tried setting up an ext app config for perl (since I'm able to run the script find with perl from command line), also tried using cgi daemon. The furthest I've got with getting litespeed to run this is with the cgi daemon. I'm stuck at this error message though:

    DBI connect('COMMERCEDB.DTISERV2.COM','dti_join',...) failed: ERROR OCIEnvNlsCreate. Check ORACLE_HOME (Linux) env var or PATH (Windows) and or NLS settings, permissions, etc. at /usr/local/dti/lib/DBConnect.pm line 101

    I'm explicitly set in the code the environment variables it's looking for. What ever is happening is not being written in the logs.

    Sorry if my explanation is confusing, let me know if you need anymore info.

    I would like to set this up with lsperl but at this point I'd like to see something just work with cgi daemon.
  2. NiteWave

    NiteWave Administrator

  3. hdee

    hdee New Member

  4. NiteWave

    NiteWave Administrator

    I restarted lsws on demo, that fixed it.

    actually, you can do it too --- anyone can play with the admin console of the demo.
  5. hdee

    hdee New Member

    Hi NiteWave,

    I found the admin console and was checking out settings for perl. I had set everything up on my end exactly the same as the admin console but it didn't work. lsperl won't recognize my fcgi files as perl scripts. I can get everything to run using a cgi daemon (not ideal of course) but I run into the error I posted originally even though the paths it's looking for is set.

    I didn't know where to go from here because I've looked at all the documentation litespeed already provides and can't get any direction from error logs.

    Is there any known problem with running perl programs with lsperl that already use CGI::Fast or FCGI?
  6. hdee

    hdee New Member

    I have some more to add actually.

    At my company we're trying to migrate from zeus web server to litespeed. I'm working on converting a perl cgi application currently. With zeus everything runs fine. When I run the perl cgi from command line it's also able to run properly.

    The only error info I was able to get was this:


    [Mon Jul 16 15:02:25 2012] lsperld.fpl: Missing right curly or square bracket at (eval 2) line 5024, at end of line
    [Mon Jul 16 15:02:25 2012] lsperld.fpl: syntax error at (eval 2) line 5024, at EOF

    After viewing lsperld I noticed it opened whatever script it is going to run and reads in the code then executes it. Does this mean lsperl is not reading in the script it's about to run properly? There is a lot of japanese characters in these scripts, could that affect anything?
  7. NiteWave

    NiteWave Administrator

    ok, is it possible you send us a sample perl code, and let's experiment on our lab?
  8. hdee

    hdee New Member

    Hi NiteWave,

    Thanks for working with me on this. I can't send you sample code for this because this perl cgi application is complex and private. I have more information to give though, perhaps you can guide me to the right answer or explain more indepth on lsperld.



    lsperld.fpl
    -------------
    my $__sub = <FH>;
    close FH;

    $__package = valid_package_name($__filename);
    #wrap the code into a subroutine inside our unique package
    my $__eval = qq{package $__package; use subs qw(exit); sub exit { } sub handler { local \$0='$__filename'; $__sub; }};
    {
    # hide our variables within this block
    my($__filename,$__mtime,$__package,$__sub);
    print $__eval;
    eval $__eval;
    }
    -------------


    ------end of $__eval output------
    } # }}}

    1;
    __END__ <-- end of script


    ; } <--- this part is inserted by lsperld.fps

    [Tue Jul 17 14:44:11 2012] lsperld.fpl: Missing right curly or square bracket at (eval 2) line 5034, at end of line
    [Tue Jul 17 14:44:11 2012] lsperld.fpl: syntax error at (eval 2) line 5034, at EOF
    Status: 500
    Content-type: text/plain

    ERROR: '/data/httpsd/join_20120604_emerchantpay/cgi-bin/newjoin.fcgi' is not a valid Perl script!

    ----------------------------------

    The error message here doesn't make sense since the actual perl cgi file has no syntax errors. After poking around I noticed when I delete __END__ from the end of the perl cgi then lsperld doesn't spit any errors out when I run from the command line. What happens now though is when I run the perl cgi through my browser it gets a broken pipe and doesn't actually process the perl cgi code. It spits out half of the script to the browser then the process times out after a while.

Share This Page