How to make a CGI app with harbour + apache server

876 views
Skip to first unread message

Itamar M. Lins Jr. Lins

unread,
Jan 12, 2012, 5:36:33 PM1/12/12
to harbou...@googlegroups.com
Hi!
<code>
request HB_GT_CGI
function main
?? "<html><body><h1>It works!</h1></body></html>"
<end code>

hbmk2 -gtcgi test.prg
http://localhost/cgi-bin/test.exe

but apache return

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, xx...@xxx.com 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.


Best regards,

Itamar M. Lins Jr.



Vailton Renato

unread,
Jan 13, 2012, 7:55:52 AM1/13/12
to harbou...@googlegroups.com

Att,
Vailton Renato

--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: http://groups.google.com/group/harbour-users

Bruno Luciani

unread,
Jan 13, 2012, 9:22:24 AM1/13/12
to harbou...@googlegroups.com
I just test this sample , and works like a charm on one of my hostings

Hosting are linux , and  I need to put wrights to 755 to work ok


Bruno

2012/1/13 Vailton Renato <vai...@gmail.com>

Itamar M. Lins Jr. Lins

unread,
Jan 13, 2012, 11:26:35 AM1/13/12
to harbou...@googlegroups.com
Hi, Vailton!
But there is a problem with Apache because, I found a problem:
If the program initialise response with    ( ?? "<html>..." ) not work in Apache and IIS.
Is necessary initialise response with (? "<html>...") thus work in IIS 7 but with apache 2.2 not work, very strange :-(

My httpd.conf
...
ScriptAlias /cgi-bin/ "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/"

<Directory "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin">
            AllowOverride None
         Options FollowSymLinks Includes ExecCGI
            AddHandler cgi-script .exe .prg
</Directory>
...

Any other tips ?


Best regards,
Itamar M. Lins Jr.

2012/1/13 Bruno Luciani <bruno....@gmail.com>

Itamar M. Lins Jr. Lins

unread,
Jan 13, 2012, 12:09:12 PM1/13/12
to harbou...@googlegroups.com
Ok, my fault.
Is necessary initalise with:
 OutStd("CONTENT-TYPE: TEXT/HTML"...

Now works fine APACHE and IIS 7.


Best regards,
Itamar M. Lins Jr.

2012/1/13 Itamar M. Lins Jr. Lins <itama...@gmail.com>

Mel_the_Snowbird

unread,
Jan 14, 2012, 12:49:43 PM1/14/12
to Harbour Users
Itamar:

All four of my web sites use xHabour and Apache as CGI apps. It
would only be a tiny bit of work to change over to Harbour for these
CGI apps.



On Jan 13, 10:09 am, "Itamar M. Lins Jr. Lins" <itamarl...@gmail.com>
wrote:
> Ok, my fault.
> Is necessary initalise with:
>  OutStd("CONTENT-TYPE: TEXT/HTML"...
>
> Now works fine APACHE and IIS 7.
>
> Best regards,
> Itamar M. Lins Jr.
>
> 2012/1/13 Itamar M. Lins Jr. Lins <itamarl...@gmail.com>
>
>
>
> > Hi, Vailton!
> > But there is a problem with Apache because, I found a problem:
> > If the program initialise response with    ( ?? "<html>..." ) not work in
> > Apache and IIS.
> > Is necessary initialise response with (? "<html>...") thus work in IIS 7
> > but with apache 2.2 not work, very strange :-(
>
> > My httpd.conf
> > ...
> > ScriptAlias /cgi-bin/ "C:/Program Files/Apache Software
> > Foundation/Apache2.2/cgi-bin/"
>
> > <Directory "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin">
> >             AllowOverride None
> >          Options FollowSymLinks Includes ExecCGI
> >             AddHandler cgi-script .exe .prg
> > </Directory>
> > ...
>
> > Any other tips ?
>
> > Best regards,
> > Itamar M. Lins Jr.
>
> > 2012/1/13 Bruno Luciani <bruno.luci...@gmail.com>
>
> >> I just test this sample , and works like a charm on one of my hostings
>
> >> Hosting are linux , and  I need to put wrights to 755 to work ok
>
> >> Bruno
>
> >> 2012/1/13 Vailton Renato <vail...@gmail.com>
> >> Web:http://groups.google.com/group/harbour-users- Hide quoted text -
>
> - Show quoted text -

Alex Schaft

unread,
Apr 10, 2012, 7:15:30 AM4/10/12
to harbou...@googlegroups.com
I'm trying some cgi with wampserver. My apache 2.2.21 keeps wanting to download my exe file to the browser. Does anyone know what setting I'm missing?

In httpd.conf I have

LoadModule cgi_module modules/mod_cgi.so

<IfModule cgi_module>
    AddHandler cgi-script .exe
</IfModule>

and my alias setup:

ScriptAlias /qtrav/ "c:/dev/qtravweb/"

<Directory "c:/dev/qtravweb/">
    AllowOverride all
    Allow from 127.0.0.1
        Order Deny,Allow
    Deny from all

    Options FollowSymLinks Includes ExecCGI
    AddHandler cgi-script .exe
</Directory>


Alex

Bruno Luciani

unread,
Apr 10, 2012, 7:50:34 AM4/10/12
to harbou...@googlegroups.com
THe only thing that I see strange is the space betwen cgi-script and the dot before exe extension
in two parts of your apache.conf , check this

Bruno

2012/4/10 Alex Schaft <asc...@gmail.com>

Alex Schaft

unread,
Apr 10, 2012, 9:19:10 AM4/10/12
to harbou...@googlegroups.com
On 2012/04/10 01:50 PM, Bruno Luciani wrote:
> THe only thing that I see strange is the space betwen cgi-script and
> the dot before exe extension
> in two parts of your apache.conf , check this
>
Bruno,

That line is the same as I got from

http://httpd.apache.org/docs/2.0/mod/mod_mime.html#addhandler


Bruno Luciani

unread,
Apr 10, 2012, 9:43:53 AM4/10/12
to harbou...@googlegroups.com
ok ok is refering to all  .exe files

Bruno

2012/4/10 Alex Schaft <asc...@gmail.com>
On 2012/04/10 01:50 PM, Bruno Luciani wrote:
--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.

Reply all
Reply to author
Forward
0 new messages