logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Apache 2.4.2 (Win64) cgi automation error Page 1, 2  Next
Author
msutter



Joined: 01 May 2012
Posts: 9
Location: USA, Heber City

PostPosted: Sun 13 May '12 17:18    Post subject: Apache 2.4.2 (Win64) cgi automation error Reply with quote

I am trying to setup Apache 2.4.2 (Win64) mod_fcgid/2.3.7 OpenSSL/1.01.1a on Windows 2008R2 64bit. My cgi bin alias is set properly and was working with with Apache 2.4.2 (Win32) on the same machine. However, when running my VB6 cgi programs in Apache 2.4.2 (Win64), they crash with an automation error. There are NO erros in the Apache log files.

The only hint I may have is the following...
I tested the same cgi programs under IIS7 on the same Windows 2008R2 64bit machine. I got the same automation error at first. I found that I had to change the CGI setting "Impersonate User" to false and then the programs worked fine in IIS7. I cannot find this kind of setting in Apache64 configs. Not that it is the answer, but maybe.

By the way, my php running as fast cgi in Apache64 is working fine. It is the cgi that seems to be the problem.

Thanks for any help or ideas.
John
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Tue 15 May '12 6:49    Post subject: Reply with quote

What scripts do you want to run over cgi? If you only use php over fcgid you don't need normal cgi.
Back to top
msutter



Joined: 01 May 2012
Posts: 9
Location: USA, Heber City

PostPosted: Tue 15 May '12 18:50    Post subject: Reply with quote

James
I run both php and vb6.exe cgi programs/scripts.
The vb6.exe cgi programs will not be ported over to php, they both run on same server.

John
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Tue 15 May '12 22:55    Post subject: Reply with quote

So than, how did you configure cgi in your httpd.conf?

Quote:

they crash with an automation error


details? Browser warning? Windows warning?
Back to top
msutter



Joined: 01 May 2012
Posts: 9
Location: USA, Heber City

PostPosted: Wed 16 May '12 6:48    Post subject: Reply with quote

I set my httpd.conf as I always have with the following...

LoadModule cgi_module modules/mod_cgi.so

ScriptAlias /bin/ "c:/apache/bin/"

<Directory "c:/apache/bin">
AllowOverride None
Options None
Require all granted
</Directory>

This is how I run my vb6.exe cgi programs currently in Apache 2.4.2 (Win32).
But of course they won't run in the Apache 2.4.2 (Win64).
No browser warnings. My vb6.exe program crashes with Automation Error and ends properly.
Thank you for your time on this James.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Wed 16 May '12 10:41    Post subject: Reply with quote

the bin folder where httpd.exe is should not be used for a script alias. Better use the cgi-bin or a new folder.

Options for that folder must allow ExecCGI
Also you have to add the extension for cgi execution to tell apache what it shall do with it.

LoadModule cgi_module modules/mod_cgi.so

ScriptAlias /bin/ "c:/apache/cgi-bin/"

<Directory "c:/apache/cgi-bin">
SetHandler cgi-script
AllowOverride None
Options ExecCGI
Require all granted
</Directory>
Back to top
msutter



Joined: 01 May 2012
Posts: 9
Location: USA, Heber City

PostPosted: Wed 16 May '12 23:20    Post subject: Reply with quote

James
Don't be fooled by the name c:/apache/bin
The httpd.exe is NOT there. This is my htdocs and bin files as my root web.
The program/binaries are over in C:/Apache24/

So that being said, I do have the Options ExecCGI and SetHandler cgi-script set properly, I just didn't put that here in the directory.

Remember, my VB6.exe cgi are working in Apache(Win32) and NOT in Apache(Win64).
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Thu 17 May '12 0:35    Post subject: Reply with quote

curious, have you added .exe to the list

AddHandler cgi-script .cgi .pl .exe
Back to top
msutter



Joined: 01 May 2012
Posts: 9
Location: USA, Heber City

PostPosted: Thu 17 May '12 6:17    Post subject: Reply with quote

I just added .exe to the list per your recommendation.
It still gets an automation error.
There must be something different between Apache(win64) and Apache(win32) when running these 32bit VB6.exe cgi programs.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Thu 17 May '12 12:12    Post subject: Reply with quote

Does your programm run for itself on the command line on that machine?
Does your programm send the correct header?
Back to top
msutter



Joined: 01 May 2012
Posts: 9
Location: USA, Heber City

PostPosted: Thu 17 May '12 14:44    Post subject: Reply with quote

It runs under the VB runtime engine, being a vb6 program. It has run for 10 years brilliantly processing thousands of store orders. Yes the correct headers are returned. It has run on regular Apache prior to Apache Lounge's versions and has run very well in ApacheLounge(Win32). The program has not changed and is not new.

By the way James, I trouble shot running the program on this Windows2008R2 64bit machine. I ran the program away from Apache(Win64) and it runs on the machine fine. So OS comparability is fine. I wonder if there are some rights issues when run under the Apache(Win64) cgi.

Thank you again for your continuing efforts.
Back to top
dalmatec



Joined: 18 May 2012
Posts: 1
Location: Italy,Pistoia

PostPosted: Fri 18 May '12 16:14    Post subject: Reply with quote

I've the same problem.My cgi program written in vb5 run well on Windows XP but now I get the automation error after porting the program on Windows 7 with Apache 2.2.It seems that the error comes out when the vb cgi creates an instance of an object that resides in an ActiveX dll.Probably this is due to some rights restrictions.Even running the Apache service with administration privileges doesn't fix the bug.
Back to top
msutter



Joined: 01 May 2012
Posts: 9
Location: USA, Heber City

PostPosted: Sun 20 May '12 5:29    Post subject: Reply with quote

Yes, you may be right. I further debugged my program and and got it to respond write to a web page successfully, but when I tried to add a declared ADODB.Recordset and connect to my SQLCLI driver it crashes. I also tried running Apache with an administrator account but doesn't help.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Tue 22 May '12 14:52    Post subject: Reply with quote

msutter wrote:
[...]got it to respond write to a web page successfully, but when I tried to add a declared ADODB.Recordset and connect to my SQLCLI driver it crashes.[...]


Is that crash only while running it as cgi or also on the command line?
Back to top
msutter



Joined: 01 May 2012
Posts: 9
Location: USA, Heber City

PostPosted: Tue 29 May '12 19:18    Post subject: Reply with quote

Only crashes as CGI running under Apache(Win64)....it works if a run from command line as user or administrator.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Mon 04 Jun '12 14:38    Post subject: Reply with quote

The only thing we haven't asked for is the windows event log. Any information there?
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Mon 04 Jun '12 19:33    Post subject: Reply with quote

I think (wild guess) Apache is spawning a 64 bit process (it is running as x64) to run a 32 bit app and Windows doesn't like it.
Back to top
msutter



Joined: 01 May 2012
Posts: 9
Location: USA, Heber City

PostPosted: Mon 18 Jun '12 18:43    Post subject: Reply with quote

dalmatec wrote:
I've the same problem.My cgi program written in vb5 run well on Windows XP but now I get the automation error after porting the program on Windows 7 with Apache 2.2.It seems that the error comes out when the vb cgi creates an instance of an object that resides in an ActiveX dll.Probably this is due to some rights restrictions.Even running the Apache service with administration privileges doesn't fix the bug.



dalmatec
Have you had any resolve regarding this issue? I have proven that you are correct.
I simplified the program to
Dim rs as NEW ADODB.Recordset
The Dim above does not crash the program...the next line does crash however.
rs.Fields.Append "NAME", adVarChar

Automation error
The specified module could not be found. Error Number = -2147024770 SOURCE: test_cgi

Hope this little extra info can help those at Apache Lounge.
I may test some other wamp 64 bit compiler sites as well.
Back to top
vm505



Joined: 20 May 2014
Posts: 2
Location: Aachen, De

PostPosted: Tue 20 May '14 14:05    Post subject: Reply with quote

If you have a combination of windows x64, apache and a win32 cgi (exe) using ADODB you have the problem that the enviroment variable CommonProgramFiles(x86)is translated into CommonProgramFiles_x86_

Adodb needs that env-variable to find the software, so it ends there.


The problem lies in util_script.c (2.4.9)

AP_DECLARE(char **) ap_create_environment(apr_pool_t *p, apr_table_t *t)
{
...
while (*whack != '=') {
if (!apr_isalnum(*whack)) {
*whack = '_';
}
++whack;
}
...
}


I propose a Change into :

while (*whack != '=') {
if (!apr_isalnum(*whack) && *whack != '(' && *whack != ')') {
*whack = '_';
}
++whack;
}


You also need the following in Httpd.conf:

SetEnv ProgramFiles "C:\Program Files"
SetEnv "ProgramFiles(x86)" "C:\Program Files (x86)"
SetEnv ProgramFilesW6432 "C:\Program Files"
SetEnv CommonProgramFiles "C:\Program Files\Common Files"
SetEnv "CommonProgramFiles(x86)" "C:\Program Files (x86)\Common Files"
SetEnv CommonProgramFilesW6432 "C:\Program Files\Common Files"

I tested the proposal with httpd 2.2 and httpd 2.4.9. Works fine.

Send me a message if you need the mod_cgi.so file

cheers

John
Back to top
Greg Oakville



Joined: 24 Sep 2015
Posts: 1
Location: Canada

PostPosted: Thu 24 Sep '15 12:33    Post subject: Reply with quote

I also need this module 2.4.16 to fix the adodb location problem in 64bit windows. Don't know how to message you.
Back to top


Reply to topic   Topic: Apache 2.4.2 (Win64) cgi automation error View previous topic :: View next topic
Post new topic   Forum Index -> Apache Page 1, 2  Next