Still not talking!
Okay... Rebooting the computer made no difference whatsoever. So I built a minimal script as follows: #!perl print (Content-type: text/html\n\n); use strict; use vars qw($query $dsn $driver $db_username $db_password $dbh); require 5.006; $| = 1; ($0 =~ m,(.*)/[^/]+,) unshift (@INC, $1); ($0 =~ m,(.*)\\[^\\]+,) unshift (@INC, $1); use CGI qw(:standard); use CGI::Carp 'fatalsToBrowser'; $CGI::POST_MAX = (1024 * 0); $CGI::DISABLE_UPLOADS = 1; $query = new CGI; use DBI(); $driver = mysql; $dsn = DBI:$driver:database=shapeshifter;host=localhost; $db_username = ; $db_password = ; warn Before DBI-connect(): [$$]; $dbh = DBI-connect($dsn, $db_username, $db_password, {'RaiseError' = 1}) or die sprintf Error: %s.\n, DBI-errstr; warn After DBI-connect() [$$]; my $sth = $dbh-prepare(SELECT * FROM frontpage); $sth-execute(); while (my $ref = $sth-fetchrow_hashref()) { print qq~Found a row: id = $ref-{'serial_number'}, name = $ref-{'position'}BR~; } $sth-finish(); $dbh-disconnect(); if ($ENV{'MOD_PERL'}) { print Mod_perl is installed on this server: $ENV{'MOD_PERL'}brbr\n; } else { print Mod_perl is not installed on this serverbrbr\n; } When running this I get a 200 OK message in the browser as follows: OK The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, [EMAIL PROTECTED] and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. Apache/1.3.19 Server at localhost Port 80 The error.log file (Apache) contains the following: [Tue May 22 02:35:03 2001] nul: Before DBI-connect(): [500] at e:/pad/htdocs/internet/system/db_test.cgi line 20. [Tue May 22 02:35:03 2001] [error] DBI-connect failed: Can't connect to MySQL server on 'localhost' (10061) at e:/pad/htdocs/internet/system/db_test.cgi line 21 Now I'm completely stumped. Can anyone spot anything obvious from this? FYI, I have attached my httpd.conf in its entirety in case that helps. Kindest regards, Jonathan M. Hollin Digital-Word.com httpd.conf
RE: Still not talking!
$db_username = ; $db_password = ; warn Before DBI-connect(): [$$]; $dbh = DBI-connect($dsn, $db_username, $db_password, {'RaiseError' = 1}) or die sprintf Error: %s.\n, DBI-errstr; You're probably not getting your error message because you have RaiseError on. From the DBI pod: RaiseError (boolean, inherited) This attribute can be used to force errors to raise exceptions rather than simply return error codes in the normal way. It is off by default. When set on, any method which results in an error will cause the DBI to effectively do a die($class $method failed: $DBI::errstr), where $class is the driver class and $method is the name of the method that failed. E.g., DBD::Oracle::db prepare failed: ... error text here ... So DBI is dying before your die ... as to why you can't connect? I'm not sure yet. Still thinking ... -- Jason Bodnar [EMAIL PROTECTED]
RE: Still not talking!
:: You're probably not getting your error message because you have :: RaiseError on. Have corrected that - but the results haven't changed in any way. Kindest regards, Jonathan M. Hollin Digital-Word.com
RE: Still not talking!
Hi, These are my 5 cents to the problem :) In the error log is a error code 10061 (Which stands for connection refused) this means that the application cannot even open a connection to the mysql server. Maybe you should also provide the DSN with a port number. Or try to use 127.0.0.1 instead of localhost. Greetings Guido Moonen -Original Message- From: Jonathan M. Hollin [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 22, 2001 3:38 AM To: [EMAIL PROTECTED] Subject: Still not talking! Okay... Rebooting the computer made no difference whatsoever. So I built a minimal script as follows: #!perl print (Content-type: text/html\n\n); use strict; use vars qw($query $dsn $driver $db_username $db_password $dbh); require 5.006; $| = 1; ($0 =~ m,(.*)/[^/]+,) unshift (@INC, $1); ($0 =~ m,(.*)\\[^\\]+,) unshift (@INC, $1); use CGI qw(:standard); use CGI::Carp 'fatalsToBrowser'; $CGI::POST_MAX = (1024 * 0); $CGI::DISABLE_UPLOADS = 1; $query = new CGI; use DBI(); $driver = mysql; $dsn = DBI:$driver:database=shapeshifter;host=localhost; $db_username = ; $db_password = ; warn Before DBI-connect(): [$$]; $dbh = DBI-connect($dsn, $db_username, $db_password, {'RaiseError' = 1}) or die sprintf Error: %s.\n, DBI-errstr; warn After DBI-connect() [$$]; my $sth = $dbh-prepare(SELECT * FROM frontpage); $sth-execute(); while (my $ref = $sth-fetchrow_hashref()) { print qq~Found a row: id = $ref-{'serial_number'}, name = $ref-{'position'}BR~; } $sth-finish(); $dbh-disconnect(); if ($ENV{'MOD_PERL'}) { print Mod_perl is installed on this server: $ENV{'MOD_PERL'}brbr\n; } else { print Mod_perl is not installed on this serverbrbr\n; } When running this I get a 200 OK message in the browser as follows: OK The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, [EMAIL PROTECTED] and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. -- -- Apache/1.3.19 Server at localhost Port 80 The error.log file (Apache) contains the following: [Tue May 22 02:35:03 2001] nul: Before DBI-connect(): [500] at e:/pad/htdocs/internet/system/db_test.cgi line 20. [Tue May 22 02:35:03 2001] [error] DBI-connect failed: Can't connect to MySQL server on 'localhost' (10061) at e:/pad/htdocs/internet/system/db_test.cgi line 21 Now I'm completely stumped. Can anyone spot anything obvious from this? FYI, I have attached my httpd.conf in its entirety in case that helps. Kindest regards, Jonathan M. Hollin Digital-Word.com