Daryl Lee wrote:
The following is the full report of a problem I'm having. Any pointers
will be appreciated. I'm worried I may have the wrong "mod_perl2"--it's
not clear to me why the version number should be "1.99_08"; I expected
"2.x".

-------------8<---------- Start Bug Report ------------8<----------
1. Problem Description:

DBI doesn't connect to MySQL when running under mod_perl2's perl-script.

The following script works correctly when run from the command line, as
#cgi-bin/dbi.pl,
or as a standard CGI script, i.e.,
http://localhost/cgi-bin/dbi.pl. But when run as precompiled under mod_perl2, i.e, as http://localhost/cgi/dbi.pl,
the connection fails with DBI=>errstr() reporting
"Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)".
The last line of error_log is:
DBI connect('people','apache',...) failed: Can't connect to local MySQL
server through socket '/tmp/mysql.sock' (2) at
/usr/local/apache2/perl/dbi.pl line 5
I also installed Apache::DBI and "use"'d it, with the same result.
It's weird that the error is not very descriptive. What about perms of /tmp/mysql.sock? it's possible that mod_cgi and mod_perl aren't running under the same username? Try printing out $< and $> from your script under CGI and mod_perl.

In any case, your script works just fine for me, though I was connecting to:

my $dbh = DBI->connect('DBI:mysql:test', '', '');

__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to