Dear monks, a simple but frustrating problem: my cgi script interacts just fine with the database when I run it from the command line, but won't connect when I run it through apache. The /var/log/apache/error_log says:
DBI connect('fab:127.0.0.1:3306','fab',...) failed: Can't create TCP/I +P socket (1) at /var/www/cgi-bin/fab.cgi line 180 Couldn't connect to database: Can't create TCP/IP socket (1) at /var/w +ww/cgi-bin/fab.cgi line 180.
I am not entirely sure where to start solving this. I'm running MySQL Ver 12.22 Distrib 4.0.20a, for Win95/Win98 (i32), Server version: Apache/1.3.29 (Cygwin), I compiled the MySQL client under Cygwin to get the library and header files (as per the recipe at http://search.cpan.org/src/RUDY/DBD-mysql-2.9004/INSTALL.html#windows/cygwin), and perl v5.8.5 built for cygwin-thread-multi-64int. I reinstalled the latest versions for DBI and DBD::mysql today. The incantation:
$dbh = DBI->connect("DBI:mysql:fab:127.0.0.1:3306",$user,$pass);
works fine when I execute the script from the command line, but not when invoked by apache. I hope this is not bad form to ask here, because I'm worried it might be a permissions thing w.r.t. the apache process? Not sure what to do, I didn't change anything in httpd.conf? Thanks, as always.

Edited by Chady -- converted <pre> to <code> tags.


In reply to DBI, DBD::MySQL, Apache & Cygwin by rvosa

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.