Hi,
I have Red Hat 7 installed and running.
I also have the bundled Apached and Perl (seemingly) running o.k.
I have installed MySQL, and the DBI/DBD-MySQL modules.
They all seem o.k.:
I can my Perl script from the command line, and it will succcessfully
retireve the data from the mySQL DB.
I can run a simple Perl script through the server and that also works
o.k. (returns basic environment variables, prints hello, edits html
template, etc.)
But I am having lots of problems running the Perl script to access the
MySQL DB through the Apache server.
The error I get is the following 500 error:
-----
Internal Server Error
The server encountered an internal error or misconfiguration and was
unable to complete your request
etc etc
-------
I checked the error log, which says the DBI->connect command failed,
and that it could no conenct to the local MySQL server (everything
here is running through the local server) through socket
'/var/lib/mysql/mysql.sock' (111)
Like I say, I have run the code from the command line (with the CGI
element) and it will connect to the MySQL DB without any difficulty.
I am quite new to both Linux and Apache: could someone please point
out what is going on here?
If it is an internal configuration error, then which bit, and what do
I need to do? (I have searched through the httpd.conf file and can
find nothing obvious)
Any pointers are very much appreciated,
Lorenzo.
P.S. - Here is a copy of the (very basic) Perl script:
--------
#!/usr/bin/perl
use CGI;
use DBI;
$dbh = DBI->connect("DBI:mysql:one_db", "serf", "readonly")
|| die "Could not connect to database: $DBI::errorstr\n";
$sqlstatement = "SELECT * FROM Names;";
$sth = $dbh->prepare($sqlstatement);
$sth->execute ||
die "Could not execute SQL statement ... maybe invalid?";