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

Oh great ones... Platform: Sunfire 280R, Solaris 8
Software: Apache 1.3.12
mySQL 3.23.45
perl 5.6.0

When running my query from the command line, like so:

root@comrcu02emsprod:/usr/local/apache/cgi-bin/lookup# ./service_lookup.cgi
I get:
Content-type:text/html<br> <HTML><HEAED><TITLE>Service to Device Lookup</TITLE> </HEAD> <BODY> Connecting to business_services using u: user, p: name ... Preparing statement: SELECT device_id, service_id, description, locati +on_id, managed, chgcontrol, ip FROM service_to_device LEFT JOIN devic +es ON service_to_device.device_id=devices.name WHERE service_to_devic +e.device_id='routing' Executing statement... Binding columns... Looping... routing, compass, M&T Routing routing, firewall, M&T Routing routing, groupwise, M&T Routing routing, imail, M&T Routing routing, webbusiness, M&T Routing routing, mandtbankcom, M&T Routing </BODY> </HTML>
This is the expected result.

But when I try to run the same cgi from a web browser, I just get:

Connecting to business_services using u: user, p: name ...

In my error_log for httpd, I get:
install_driver(mysql) failed: Can't load '/usr/local/lib/perl5/site_pe +rl/5.6.0/sun4-solaris/auto/DBD/mysql/mysql.so' for module DBD::mysql: + ld.so.1: /usr/bin/perl: fatal: /usr/local/mysql/lib/mysql/libmysqlcl +ient.so.10: Permission denied at /usr/local/lib/perl5/5.6.0/sun4-solaris/DynaLoader.pm line 200.
So it looks like I have something messed up in my library. How do I fix this? I verified that I have mysql.so. Is this the module I'm having the problem with?

Thanks,
Paul

edit (broquaint): added <code> tags

Replies are listed 'Best First'.
Re: mysql/perl library problem
by Abigail-II (Bishop) on Nov 01, 2002 at 14:58 UTC
    Make sure the UID under which apache runs has proper access to the mentioned library (and all other files needed by the program).

    Abigail

      The UID is nobody. It has access to all modules. Could a module not be configured correctly?
        I didn't question the access to the module. I questioned the access to the library. The mysql library, which is used by the Perl module. Does your OS require proper setting of the LD_LIBRARY_PATH or LD_RUN_PATH environment variable?

        It is of course possible a module isn't correctly configured, but neither the error message, nor the fact it runs fine from the command line (with a different UID?) suggests that.

        Abigail

Re: mysql/perl library problem
by Tanalis (Curate) on Nov 01, 2002 at 15:01 UTC
    Not sure if this is the case, but check that the perl module you're trying to load is accessible from the web-browser.

    The file permissions should be set to at least read, if not read-execute for "everyone else" (ie permissions something like
    -rwxr-xr-x).

    Hope that helps ..
    --Foxcub

      The file permissions on all directories and files are at least r+x for everyone. In some directories, there is w for owner and group. I checked each level of directories just to make sure files inside some directories were not getting masked accidentally.
Re: mysql/perl library problem
by vek (Prior) on Nov 01, 2002 at 15:42 UTC
    Judging from the error message you found in your error_log it certainly looks like a file permissions problem. You ran your test on service_lookup.cgi as root but your httpd is running under the user nobody. Make sure nobody has permission to read the necessary libraries.

    -- vek --
Re: mysql/perl library problem
by fglock (Vicar) on Nov 01, 2002 at 19:58 UTC

    "nobody" needs permissions at /usr/local/mysql/lib/mysql/* too.

      For all who care...thanks for the pointers. It turned out to be a rights issue as most of you probably thought. I had to enable execute on all the directories, not just read. Is this correct? Seems kind of strange, but it is working now. Thanks for the help, Paul