[Gambas-user] Gambas called by a Web Server

Christof Thalhofer chrisml at deganius.de
Tue May 21 09:42:25 CEST 2019

Am 21.05.19 um 00:02 schrieb Cedron Dawg:

> My thinking was Apache/MySQL/PHP as I have that setup.  However,
> being able to do it in Gambas sounds very appealing.  So, I thought I
> would go to the Farm and see if there are any good examples.  Oh no,
> too tough to find anything in there, so I will ask instead.

I use an Apache server which uses Gambas instead of PHP.
Here is an example of the virtual host definition:


<VirtualHost *>

    DocumentRoot /home/doms/degapp
    ServerName degapp

    # AssignUserId degapp deganius

    DirectoryIndex degapp.gambas

    <Directory "/home/doms/degapp">
            AllowOverride None
            Options +ExecCGI
            Require all granted
            AddHandler cgi-script .gbs
            AddHandler cgi-script .gambas
            SetHandler cgi-script

    RewriteEngine on
    RewriteRule ^.+$ /degapp.gambas [L]



The Gambas program is installed in /usr/bin/degapp.gambas.
It uses Request and Response from gb.web:


By this way every request to Apache is sent to the Gambas program via
CGI. Everything this program prints is sent back by Apache to the browser.

A response in Gambas looks like that:

Public Sub Main()

    With Response
        .Status = 200
        .ContentType = "text/plain;charset=utf-8"
    End With



Alles Gute

Christof Thalhofer

Dies ist keine Signatur

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20190521/cdac0f70/attachment-0001.sig>

More information about the User mailing list