apache mod perl dbi mysql : Premature end of script headers:

W

wana

I am posting this through groups.google.com in case anyone has the
same problem I had and, like me, searches like crazy all over the web
in vain.

I am working through the early examples in "MySQL and Perl for the
Web."

The sample script 'intro7.pl' runs fine from the command line but
gives me the error Premature end of script headers: in my browser. I
try all advice to no avail. I try chmod 755 intro7.pl, etc...

Then I find the great advice to check my server error log, which in my
case is located at:

/var/log/apache2/error_log (I found this location through my
httpd.conf)

where I see: Can't connect to local MySQL server through socket
'/var/lib/mysql/mysql.sock'

Luckily, this is a frustrating problem I have dealt with. My rpm
installed version of MySQL insists on using this location for the
socket file. I thought I had fixed this, but apparently not in the
case when DBI tries to access it for some reason.

The final fix:

change the first string in DBI->connect from
"DBI:mysql:host=localhost;...

to

"DBI:mysql:host=127.0.0.1:/tmp/mysql.sock;...

Turns out, like in PHP, the DBI module allows us to specify the mysql
socket to use.

I am sorry if this is the wrong forum for this, I just lost 2-3 hours
of my life trying to figure this one out if this posting had existed,
I might have saved a little time.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top