[Gambas-user] gambas capable webspace

T Lee Davidson t.lee.davidson at gmail.com
Thu Jul 7 21:53:25 CEST 2022


On 7/7/22 09:17, Bruce Steers wrote:
> Am i right that by default most servers/web hosts cannot run gambas cgi progs at all as it needs a gambas interpreter installed?

Yes.


> If not, are there any examples of how to correctly run the cgi's (read the wiki how-to, still not getting it)

This is not an example, but the configuration is relatively straightforward. I use OpenSUSE, and so the file names, locations, 
and configurations may be different for other distros.

For Apache2, you just need to ensure that there is a ScriptAlias defined and configured. That should be done in (/etc/apache2/) 
'default-server.conf' and looks like:

~~~
ScriptAlias /cgi-bin/ "/srv/www/cgi-bin/"

# "/srv/www/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/srv/www/cgi-bin">
  AllowOverride None
  Options +ExecCGI -Includes
  <IfModule !mod_access_compat.c>
   Require all granted
  </IfModule>
  <IfModule mod_access_compat.c>
   Order allow,deny
   Allow from all
  </IfModule>
</Directory>
~~~

Then simply place your app in this CGI directory. This works because a CGI app runs as a script. If you use the `head` command 
on a Gambas script executable file (.gambas) you will see the first line is: "#! /usr/bin/env gbr3"

Apache2 is stupid. It will try to execute virtually *every* type of file contained within the cgi-bin directory tree.

Lighttpd is a bit more intelligent. For that server, you will need to edit (/etc/lighttpd/) 'cgi.conf' found in the 'conf.d' 
directory. After editing my local installation to run Gambas CGI scripts, it looks like:

~~~
##
## Plain old CGI handling
##
## For PHP don't forget to set cgi.fix_pathinfo = 1 in the php.ini.
##
cgi.assign                 = ( ".pl"  => "/usr/bin/perl",
                                ".cgi" => "/usr/bin/perl",
                                ".rb"  => "/usr/bin/ruby",
                                ".erb" => "/usr/bin/eruby",
                                ".py"  => "/usr/bin/python",
                                 ".gambas" => "/usr/bin/gbr3")
~~~


-- 
Lee


More information about the User mailing list