Author |
|
MiltSpain1
Joined: 04 Sep 2016 Posts: 38 Location: USA
|
Posted: Fri 01 Feb '19 0:48 Post subject: Cannot connect to MySql db After Apache 2.2 Reinstall |
|
|
My Apache2.2.11 was running perfectly on Windows Server 2012 for 3 years when it suddenly crashed and had to be reloaded. I have a website (virtual host) on Apache and a Mysql database on the same drive. After reloading the Apache with what I thought was the exact Httpd config I am unable to get my PERL cgi programs to connect to the database even though the PERL and Mysql files appear to be exactly as they were previously. The Mysql database is live and can be accessed remotely and inquiries made at the command prompt. Consequently I think something is amiss in the Apache Httpd config file. Any suggestions as to where my problem lies will be sincerely appreciated. Thanks!
Milt Spain |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7373 Location: Germany, Next to Hamburg
|
Posted: Fri 01 Feb '19 9:50 Post subject: |
|
|
You should upgrade to Apache 2.4. The 2.2 version is no longer supported.
Anything in the apache error log? Windows event log? PHP error log? |
|
Back to top |
|
MiltSpain1
Joined: 04 Sep 2016 Posts: 38 Location: USA
|
Posted: Fri 01 Feb '19 14:48 Post subject: |
|
|
Just got these. First time I've seen them.
[Fri Feb 01 06:40:59 2019] [error] [client 97.124.80.68] E:/Pinnacle/DiversityLink/cgi-bin/member_selections_htm.pl is not executable; ensure interpreted scripts have "#!" first line, referer: http://www.diversitylink.com/cgi-bin/showmenu2.pl
[Fri Feb 01 06:40:59 2019] [error] [client 97.124.80.68] (9)Bad file descriptor: don't know how to spawn child process: E:/Pinnacle/DiversityLink/cgi-bin/member_selections_htm.pl, referer: http://www.diversitylink.com/cgi-bin/showmenu2.pl |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7373 Location: Germany, Next to Hamburg
|
Posted: Fri 01 Feb '19 16:15 Post subject: |
|
|
If you open one of those files with for example Notepad++ do you see the correct line ending for Windows? |
|
Back to top |
|
MiltSpain1
Joined: 04 Sep 2016 Posts: 38 Location: USA
|
Posted: Fri 01 Feb '19 17:31 Post subject: |
|
|
Not sure what you mean by "correct line ending for Windows" but the programs all ran perfectly previously. Here is the begining lines of one program:
##memberselections.pl
#!C:/Perl/bin/perl -w
use strict;
use CGI qw(:standard);
###print "content-type: text/html\n\n";
use DBI;
my ($dbh, $sth);
my $AccountID=param('AccountID');
my $PW=param('Password');
$dbh = DBI->connect('dbi:mysql:membersdb','member','memberpasswd') || die "cannot open";
$sth = $dbh->prepare("SELECT PW FROM memberid WHERE AccountID=? ");
$sth->execute ($AccountID);
An example of a cgi file that does work is:
http://www.diversitylink.com/cgi-bin/Global/USA/USA_statetoc.pl
The only programs that I cannot get to work are those that connect to the database or those that are protected by htaccess. All worked previously. |
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Sun 03 Feb '19 20:16 Post subject: |
|
|
#!C:/Perl/bin/perl -w
That (shebang) needs to be the first line of a perl script.
However you were probably using ScriptInterpreterSource in your prior config which removes that requirement. |
|
Back to top |
|
MiltSpain1
Joined: 04 Sep 2016 Posts: 38 Location: USA
|
Posted: Sun 03 Feb '19 21:27 Post subject: |
|
|
You are 100% correct!! Thanks! |
|
Back to top |
|