Mtnbkr777 has asked for the wisdom of the Perl Monks concerning the following question:

I am running Centos OS with a LAMP stack. I have perl5.8.8 installed. When I try to run a login script through a browser I get the script itself not the Login page that should be coming up. If I run the script from the command line I get the following error "Can't locate bin/xterm/login.pl in @INC.." I have checked my paths, permissions I am at a loss. I know it should be and easy fix but I can't figure it out. I originally developed the scripts on a local Ubuntu Machine the migrated to a hosting service.

Here is part of my HTTPD conf file
<VirtualHost petro-traxx.com.443> DocumentRoot /var/www/html/petro ServerName petro-traxx.com ServerAlias www.petro-traxx.com ServerAdmin webmaster@petro-traxx.com CustomLog /usr/local/apache/domlogs/petro-traxx.com-bytes_log "%{% +s}t %I .\n%{%s}t %O ." ErrorLog /usr/local/apache/domlogs/petro-error-logs CustomLog /usr/local/apache/domlogs/petro-traxx.com combined ScriptAlias /cgi-bin/ /var/www/cgi-bin/ Include sql-ledger-httpd.conf Alias /sql-ledger /var/www/html/petro/sql-ledger/ <Directory /var/www/html/petro/sql-ledger> AllowOverride All AddHandler cgi-script .pl .cgi AddDefaultCharset On Options ExecCGI Includes FollowSymlinks Order Allow,Deny Allow from All </Directory> <Directory /var/www/html/petro/sql-ledger/users> Order Deny,Allow Deny from All </Directory> </VirtualHost>
the referenced included config file is below.
Alias /petro /var/www/html/petro/ <Directory /var/www/html/petro> AllowOverride All AddHandler cgi-script .pl Options ExecCGI Includes FollowSymlinks Order Allow,Deny Allow from All </Directory> <Directory /var/www/html/petro/users> Order Deny,Allow Deny from All </Directory> Alias /sql-ledger /var/www/html/petro/sql-ledger/ <Directory /var/www/html/petro/sql-ledger> AllowOverride All AddHandler cgi-script .pl Options ExecCGI Includes FollowSymlinks Order Allow,Deny Allow from All </Directory> <Directory /var/www/html/petro/sql-ledger/users> Order Deny,Allow Deny from All </Directory>
any Ideas would be great. Thanks

Replies are listed 'Best First'.
Re: Scirpts Don't Run
by i5513 (Pilgrim) on Aug 03, 2011 at 22:28 UTC
    My tip:
    First test your LAMP (P for PERL) configuration with a simple perl script like
    #!/usr/bin/perl print "Content-type: text/plain\n\n"; print "Hello!"
    Call it test.pl and save in your cgi directory, then access via navigator

    When you are (If you are not, you have to reconfigure your LAMP installation), research why login.pl is not found in your @INC when you execute the script, maybe you can add use lib sentence in your code to use your directory with modules or load directory in PERL5LIB environment variable

    Maybe we should see the code to understand better why this message is show to you
    Regards,

      The test script works fine. in any browser use the following url and you can see my login script. https://www.petro-traxx.com/sql-ledger/login.pl The only thing the cgi-bin folder is test.pl the path to cgi-bin is /var/www/cgi-bin/ , my other scripts are in /var/www/html/petro/sql-ledger/ with www.petro-traxx.com pointing to the petro folder. Thanks for the help

        I assume you meant https://www.petro-traxx.com/cgi-bin/login.pl (according to your Apache config). I'm getting a 500 Internal Server Error, which is a good sign - it means the script is running, though obviously failing. Did you fix it already? At this point you want to check the error log for the cause.

      no I meant https:;//www.petro-traxx.com/sql-ledger/login.pl I it would be easier I could give you my login for the SSH to take a look at my setup. Login.pl is not in the CGI-Bin file. I will try to add a uselib sentence in my code and see if that works. Thanks

        I included the following line in my code use lib "/usr/lib/perl5/5.8.8/"; I have included my script. I get the fail at line 119. Thanks

        #!usr/bin/perl use lib "/usr/lib/perl5/5.8.8"; ###################################################################### # SQL-Ledger ERP # Copyright (C) 2006 # # Author: DWS Systems Inc. # Web: http://www.sql-ledger.com # ###################################################################### +# # # this script sets up the terminal and runs the scripts # in bin/$terminal directory # admin.pl is linked to this script # ###################################################################### +# # setup defaults, DO NOT CHANGE $userspath = "users"; $spool = "spool"; $templates = "templates"; $images = "images"; $memberfile = "users/members"; $sendmail = "| /usr/sbin/sendmail -t"; %printer = (); ########## end ########################################### $| = 1; eval { require "sql-ledger.conf"; }; if ($ENV{CONTENT_LENGTH}) { read(STDIN, $_, $ENV{CONTENT_LENGTH}); } if ($ENV{QUERY_STRING}) { $_ = $ENV{QUERY_STRING}; } if ($ARGV[0]) { $_ = $ARGV[0]; } %form = split /[&=]/; # fix for apache 2.0 bug map { $form{$_} =~ s/\\$// } keys %form; # name of this script $0 =~ tr/\\/\//; $pos = rindex $0, '/'; $script = substr($0, $pos + 1); @scripts = qw(login.pl admin.pl custom_login.pl custom_admin.pl); if (grep !/^\Q$form{script}\E/, @scripts) { print "Content-Type: text/html\n\n" if $ENV{HTTP_USER_AGENT}; print "\nAccess denied!\n"; exit; } if (-f "$userspath/nologin" && $script ne 'admin.pl') { print "Content-Type: text/html\n\n" if $ENV{HTTP_USER_AGENT}; if (-s "$userspath/nologin") { open(FH, "$userspath/nologin"); $message = <FH>; close(FH); print "\n$message\n"; } else { print "\nLogin disabled!\n"; } exit; } if ($form{path}) { $form{path} =~ s/%2f/\//gi; $form{path} =~ s/\.\.//g; if ($form{path} !~ /^bin\//) { print "Content-Type: text/html\n\n" if $ENV{HTTP_USER_AGENT}; print "\nInvalid path!\n"; exit; } $ARGV[0] = "$_&script=$script"; require "$form{path}/$script"; } else { if (!$form{terminal}) { if ($ENV{HTTP_USER_AGENT}) { # web browser $form{terminal} = "lynx"; if ($ENV{HTTP_USER_AGENT} !~ /lynx/i) { $form{terminal} = "mozilla"; } } else { if ($ENV{TERM} =~ /xterm/) { $form{terminal} = "xterm"; } if ($ENV{TERM} =~ /(console|linux|vt.*)/i) { $form{terminal} = "console"; } } } if ($form{terminal}) { $form{terminal} =~ s/%2f/\//gi; $form{terminal} =~ s/\.\.//g; $ARGV[0] = "path=bin/$form{terminal}&script=$script"; map { $ARGV[0] .= "&${_}=$form{$_}" } keys %form; require "bin/$form{terminal}/$script"; #line 119 } else { print "Content-Type: text/html\n\n" if $ENV{HTTP_USER_AGENT}; print qq|\nUnknown terminal\n|; } } # end of main