Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Problems with mysqlPP and Apache

by Mulga (Initiate)
on Aug 07, 2012 at 04:58 UTC ( #985882=perlquestion: print w/ replies, xml ) Need Help??
Mulga has asked for the wisdom of the Perl Monks concerning the following question:

I am running Perl on OS X. The version of Perl is 5.12.4, Apache is 2.2.1, MySql is 5.5.27

I am having a problem running using Apache with the CGI and mysqlPP modules.

I can run the following code natively without issue.

#!usr/bin/perl -w use strict; use DBI; use CGI qw(:standard); my $dbh = DBI->connect("dbi:mysqlPP:database=menagerie:host=localhost" +, uid, pwd, {'RaiseError' => 1}); print header(), start_html("Good Return - Constituent Report"), h1("Good Return - Constituent Report"); print p("Does this work?"); print p("Databases"); print p("========="); print end_html;

However when I try and run it in a browser, as intended, it fails. The following is output from the apache log. You can see that it is unable to find mysqlPP but when I look in PPM I can see that it is inatlled and I can run it natively, i.e. not as CGI.

Any help would be greatly appreciated.

========== Apache Log Start ==========</p> Perhaps the DBD::mysqlPP perl module hasn't been fully installed, or perhaps the capitalisation of 'mysqlPP' isn't right. Available drivers: DBM, ExampleP, File, Gofer, Proxy, SQLite, Sponge. at /Users/paul_griffin/Sites/testsite/html01.pl line 41 install_driver(mysqlPP) failed: Can't locate DBD/mysqlPP.pm in @INC (@ +INC contains: /LibraryPerl/5.12/darwin-thread-multi-2level /Library/P +erl/5.12 /Network/Library/Perl/5.12/darwin-<p>thread-</p>multi-2level + /Network/Library/Perl/5.12 /Library/Perl/Updates/5.12.3 /System/Libr +ary</p>/Perl/5.12/darwin-thread-multi-2level /System/Library/Perl/5.1 +2 /System/Library/Perl/Extras/5.12/darwin-thread-multi-2level /System +/Library/Perl/Extras/5.12 .) at (eval 5) line 3. Perhaps the DBD::mysqlPP perl module hasn't been fully installed, or perhaps the capitalisation of 'mysqlPP' isn't right. Available drivers: DBM, ExampleP, File, Gofer, Proxy, SQLite, Sponge. at /Users/paul_griffin/Sites/testsite/htmltest.pl line 13 Premature end of script headers: htmltest.pl

Comment on Problems with mysqlPP and Apache
Select or Download Code
Re: Problems with mysqlPP and Apache
by Anonymous Monk on Aug 07, 2012 at 07:50 UTC

    Well, if it isn't installed in the @INC that is reported in your apache log, where is it installed?

    perl -MData::Dumper -MDBD::mysqlPP -le " print Dumper( \%INC, \@INC ) "

Re: Problems with mysqlPP and Apache
by thonar (Monk) on Aug 08, 2012 at 11:19 UTC

    open a terminal and type:

    perl -le 'print for @INC'

    you should see all directorys in @INC. Now try this with the apache user, there for type:

    su - su - YOUR_APACHE_USER_NAME -c "perl -le 'print for @INC'"

    there should be some slide differences bettween them and this should be the reason for your problem.

    Try this in a new terminal:

    perl -MData::Dumper -MDBD::mysqlPP -le " print Dumper( \%INC ) " | grep "DBD/mysqlPP"

    now you can add the shown directory in your script like this:

    ... use lib qw( DIRECTORY_PATH ); use DBI; use CGI qw(:standard); ...

    sure not the best way to do this, but it should be work out.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://985882]
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (10)
As of 2014-12-28 16:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (182 votes), past polls