Steve Wilder wrote:
>
> Hi all.
>
> I've done this several times on other servers without any problems, but
> for some reason, I can't get any Perl-DBI script to talk to my MySQL
> database when Apache is involved. Command line, it works fine, but
> mod_perl/Embperl stuff causes a segmentation fault. It seems like as soon
> as I touch the DataSource for MySQL, it dies.
>
> I've been dinking with this for a week on and off, with no luck. I hope
> no one minds, but I'm going to paste some code, and error log stuff here:
>
Steve,
I don't want to be too simplistic here, but I have found that reducing a
problem to its most minimalistic form is useful when debugging. I am
writing because I actually have been having no problems at all using
mod_perl/Embperl/Apache/MySQL. And I have been through several different
versions of each of these tools, all on Red Hat Linux 6.1 and 7.0. In
each case I have built apache, mod_perl, embperl and mysql from source,
rather than using RPMs. Maybe this makes a difference, I don't know. So
the first thing I would try is getting the latest (stable) versions of
all these packages in source form and compiling them on your system, and
see if all the tests run successfully.
Then, I would try the minimal case. Something like this:
use DBI;
$dsn = "DBI:mysql:mydatabase";
$dbh = DBI->connect ($dsn);
$query = $dbh->prepare ("select * from mytable");
$query->execute();
$record = $query->fetchrow_hashref();
I notice this form is a little different from the one you are using. For
example, you give more arguments to the call to connect(). Try the
simpler form instead. I might add that I configure mysql to have no
password for the root user. I do this because I don't have other Unix
users on my server, and it is protected by a firewall anyway. In any
case, it would be useful for you to set up a test database which could
be accessed simply, without passwords - just for testing. You get the
minimal case working, then build up from there.
Hope all this is of some use.
-Neil
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]