Huge (Perl) problem: "DBD::mysql" fails on host Apache...
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Huge (Perl) problem: "DBD::mysql" fails on host Apache...
I have a Perl application that (has to...) run as a CGI application on a shared host. I have quite an intractible problem here... please read the following description c-a-r-e-f-u-l-l-y and please help me if you can.
The program uses DBD::mysql, which has been installed into the local shared-host directories and correctly placed into the @INC array via a use lib statement. All parameters are known-good. Based on the output in a log file from the web-app (when run by Apache...) I know that one of the entries in @INC does point to a location where auto/DBD/mysql/mysql.so can be found, and that it does exist.
The program works correctly when run directly from the command-line on the shared host.
When run from Apache on the same host, however, the application's log-file contains the following error:
Quote:
DBIx::Class::ResultSet::next(): DBI Connection failed: Undefined subroutine &DBD::mysql::db::_login called at /homepages/blah-blah-blah/local-perl/lib/perl/5.8.8/DBD/mysql.pm line 142.
(This is the correct file-path. And since the message is in the application's logfile, we also know that the application is running.)
All of the .so files are executable. r-xr-xr-x.
I do not have access to Apache error-log files on this host.
When run on an Apache server on my development machine... it works.
I have systematically determined that the proper copy of mysql.so is being used on my system, by having temporarily renamed all others.
In other words, here we are dealing with some kind of difference between the Apache CGI environment on the shared-host, and both the command-line environment on that host and the Apache CGI environment on my box. This is why I call the problem "intractible," and by now I am quite desperate for a solution.
Thinking of things that can be different between the Apache and Bash environment, I can think of a couple of possibilities. Firstly, when run as a child of the Apache server, the UID will be that of the Apache server. File permissions and the likes of SElinux could be at play here. Also, and I'm not sure how/if this applies to Perl, but if you are using object libraries, there must be a way for a linking loader to locate them, and the value of $LD_LIBRARY_PATH influences that. This could be different within the two environments. I don't think @INC would play a role in locating such libraries, only Perl modules, but you should be able to test this. Another issue may be the use of mod-perl on the server. I know only that there are some subtle differences between plain Perl and mod-perl, and it seems like one possible avenue to explore.
Interesting problem. Hope this helps.
--- rod.
There is no mod_perl as far as I see. Are the mysqld and the webserver running on the same box? Can't you install the DBD::mysql in a global way? Seems @INC contains different elements depending on the user excuting perl.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.