[REBOL] Re: InformIT.com Articles Introduction to Water™ A New Native We
From: gscottjones:mchsi at: 30-Aug-2002 14:26
From: "Gerard Cote"
> In a similar way, I am also currently working - shen
> free time is left - to find a way to fork a PHP or
> PERL script that could launch a REBOL engine for
> doing CGI on ISPs HOSTs that don't want to support
> REBOL CGI with their APACHE Web server. My
> own Linux based ISP doesn't want to configure its
> APACHE server for letting me do my CGI with REBOL
> and I want to show him it's easy and safe to do it -
> even the way I plan to do it.
Hi, Gerard,
There is a fairly straight forward way to do this as long as you have access
to the cgi-bin directory and can set permissions.
First, find out the ISP hardware and OS by putting the following single line
in a file named phpinfo.php :
<?php phpinfo() ?>
Upload this to your ISP, then run the page:
http://www.myserver.com/phpinfo.php
The very top box will tell you the OS and hardware. Go to REBOL's download
site, and download the appropriate /Core version (/View requires X-window,
which may not be loaded on a web server). use:
gzip -d corefilename
then
tar -xvf corefilename
You may say, but I'm on Windows, how can this work? Trust me. You won't be
running the resulting executable on your system. Find the executable (look
for a likely filename or size). Upload this to the cgi-bin directory using
binary mode. (You ONLY need this one file.) Please note that putting this
executable directly in your cgi-bin is considered a security risk!!!! (It
is supposed to be not directly accessible by the web, but we are just
talking about an experiment. Right?)
Next, you need to find the *actual path* to your cgi-bin directory. This
too can be found in the phpinfo.php page. Look for document root, and add
on any additional path to get you to the cgi-bin directory. Next you need
to find which file extension(s) that your Apache will allow (frequently
.cgi). Some ISP's will let you add to the list (like .r).
Next, create your first REBOL cgi script, like the following. Note it is
critical to change the path to exactly what you retrieved earlier. One of
the /Core's had a bug that require "-cs" to be spelled out "--cgi -s", so I
tend to use this just because.
#!/isp/server/path/to/cgi-bin/rebol --cgi -s
REBOL []
print "Content-Type: text/html^/"
print <html>
print "Hello, World!"
print </html>
Name the file, using your executable extension:
hello.cgi
and upload this file to the cgi-bin directory. You will need to change the
file permissions to 755 (different ISP's allow this to be done differently;
few seem to allow direct telnet access, which would allow the use of the
CHMOD command).
Now, on your browser, type:
http://www.myserver.com/cgi-bin/hello.cgi
and with good luck, you will see that magical message.
Remember that the REBOL executable sitting directly on a web-accessible path
is considered a security risk, so don't leave it there. Once you've
convinced your ISP to add support and they pay RT, they will put the
installation on a safe path, and then configure Apache to use an alias so
that you can access the functionality.
I would only develop scripts using a local installation, in order to avoid
hung processes. But then you'll need to remember to change the first line
#! path before uploading to the remote server.
Hope this clears up any mystery.
--Scott Jones