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

Discussion in 'Perl Misc' started by wana, Sep 17, 2004.

  1. wana

    wana Guest

    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.
     
    wana, Sep 17, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Wayne Deleersnyder

    Premature end of script headers

    Wayne Deleersnyder, Nov 21, 2003, in forum: Perl
    Replies:
    1
    Views:
    684
    Wayne Deleersnyder
    Nov 21, 2003
  2. Greeshma
    Replies:
    0
    Views:
    363
    Greeshma
    Feb 25, 2004
  3. Greeshma
    Replies:
    1
    Views:
    509
  4. Phil Frost

    Re: premature end of script headers

    Phil Frost, Jul 10, 2004, in forum: Python
    Replies:
    0
    Views:
    556
    Phil Frost
    Jul 10, 2004
  5. Kevin Layman
    Replies:
    3
    Views:
    143
    Diego Guillen
    May 22, 2009
Loading...

Share This Page