Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

URGENTperl test3.cgi runs fine at command line .. Fails when called from browser

by Anonymous Monk
on Dec 24, 2000 at 16:31 UTC ( [id://48195]=perlquestion: print w/replies, xml ) Need Help??

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

This is the script for test3.cgi
#!/usr/local/bin/perl use DBI; $first='First'; $last='Last'; print "Inserting Data"; $dbh=DBI->connect('dbi:Oracle:SURVEY','userid','password') || die "Dat +abase ca nnot be connected"; $status=$dbh->do(qq{Insert into t_friend (first_name,last_name) values +('$first', '$last')}); if($status!=0) { print "Inserted.."; } else { print "cannot Insert"; } $dbh->disconnect;

But when called from the browser I get this error:

install_driver(Oracle) failed: Can't load '/usr/local/lib/perl5/site_perl/5.6.0/ aix/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: dlopen: /usr/local/lib/pe rl5/site_perl/5.6.0/aix/auto/DBD/Oracle/Oracle.so: Permission denied at /usr/loc al/lib/perl5/5.6.0/aix/DynaLoader.pm line 200. at (eval 8) line 3 Compilation failed in require at (eval 8) line 3. Perhaps a required shared library or dll isn't installed where expected at /usr/HTTPServer/cgi-bin/test2.cgi line 31

Pls help ASAP

Replies are listed 'Best First'.
Re (tilly) 1: URGENTperl test3.cgi runs fine at command line .. Fails when called from browser
by tilly (Archbishop) on Dec 24, 2000 at 20:13 UTC
    What are the permissions on /usr/local/lib/perl5/site_perl/5.6.0/aix/auto/DBD/Oracle/Oracle.so, in particular is it readable by whatever user the webserver is running as? (Which is likely to be "nobody".)

    I have not seen your problem but the first error reported is that that file cannot be loaded, and the second is that permission was denied. I would ignore the guess made at the higher-level DynaLoader code...

Re: URGENTperl test3.cgi runs fine at command line .. Fails when called from browser
by chipmunk (Parson) on Dec 24, 2000 at 23:35 UTC
    This question is asked approximately once per day on the dbi-users list. In this case it's a permissions problem, and tilly's addressed that.

    Usually, the problem is that the LD_LIBRARY_PATH in your environment contains the path to the Oracle libraries, but for the user that runs CGI scripts (probably the user 'nobody') it doesn't.

    One solution is to modify the web server's configuration to set the LD_LIBRARY_PATH environment variable to include the path to the Oracle libraries.

    Another solution, the one that I prefer, is to add the path to the Oracle libraries to the /etc/ld.so.conf file, and then run ldconfig. That will make the Oracle library path available to all users.

Re: URGENTperl test3.cgi runs fine at command line .. Fails when called from browser
by PotPieMan (Hermit) on Dec 24, 2000 at 21:23 UTC
    This isn't the issue now, but don't forget to print HTTP headers once you get the module loaded and all. You'll need them if you want to see the output of the script from a browser. For example, add
    print "Content-Type: text/plain\n\n";
    or
    print "Content-Type: text/html\n\n";
    before any other print statements.

    Hope you get the issue with the module resolved--tilly's suggestions sound like a good starting place.

    --PotPieMan

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://48195]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (7)
As of 2024-03-28 19:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found