Simple Red CGI scripting possible

Since Red ( http://red-lang.org/ ) supports functions and becomes more and more mature almost per day, it is also possible to do a little CGI scripting.

This is a small tutorial of how this can be done.

Beacuse Red can be cross-compiled from any machine that has a working REBOL core version to any of the targets supported, chances are you can do this too.

I will not go into a lengthy explanation of how to install the correct REBOL program in the Red directory, nor will I tell you here how to use the redcompiler.r REBOL script on REBOL/View because you can find those elsewhere.

First you create a script that later needs to be compiled:


Red [ "My First Red CGI testscript"
    file: %myredcgi.red
]

print "Content-Type: text/html^/" ;-- Required Page Header

html: "<html><body>"
code: "<h2>Welcome Red CGI!!</h2> The world has been waiting for you!</body></html>"

html: append html code
print html

After this you will need to cross-compile your script to create a Linux executable.
You then have change the file extension to .cgi.

Upload the script to your (Apache) server and be sure to give it executable rights.

Probably that is all and you can test your script in the browser.

If you still encounter problems, the reason may lie in your .htaccess file on the server or in the directory above your script.
This has to contain a line that says

Options +ExecCGI

You can find more information on Red on http://red-lang.org/ and your version of REBOL to use on
http://rebol.com/ and the REBOL script to help you compile your Red CGI scripts here http://www.rebol.org/view-script.r?script=redcompiler.r

Good luck and very much fun creating your Red CGI scripts!!

This entry was posted in Programmeren, Website development. Bookmark the permalink.

12 Responses to Simple Red CGI scripting possible

  1. Arnold says:

    I have to add that I had a line
    AddHandler cgi-script r
    in my .htaccess file. And my cgi did not work any more.
    I needed to add
    AddHandler cgi-script cgi r

  2. manicure says:

    An interesting discussion is worth comment. There’s no doubt that that you should publish
    more about this topic, it might not be a taboo
    matter but typically folks don’t discuss such topics. To the next!
    Kind regards!!

  3. manicure says:

    Way cool! Some extremely valid points! I appreciate you penning this write-up and also the rest of the website is very good.

  4. XRumerTest says:

    Hello. And Bye.

  5. Stevedor says:

    Find out what you need to improve in yourself to become more effective!

  6. Antalya says:

    I like the helpful information you supply for your articles.
    I’ll bookmark your blog and check once more right here frequently.
    I’m somewhat certain I will learn a lot of new stuff right here!
    Best of luck for the following!

  7. RobertHasia says:

    I glanced through this website and there is so much handy information, bookmarked 🙂

  8. richarpiip says:

    Hello, my name is Richard Picks!

    I`m an academic writer and I`m going to change your lifes onсe and for all
    Writing has been my passion for a long time and now I can`t imagine my life without it.
    Most of my works were sold throughout Canada, USA, China and even Australia. Also I`m working with services that help people to save their time.
    People ask me “Sir, Richard, I need your professional help” and I always accept the request, `cause I know, that only I can save their time!

    Professional Writer – Richard – 31 daysbooks Band

  9. Immagokap says:

    Right here is the right website for everyone who would like to understand this topic. You realize a whole lot its almost hard to argue with you (not that I really will need to…HaHa). You definitely put a brand new spin on a topic that has been discussed for ages. Excellent stuff, just great!

Laat een reactie achter bij XRumerTest Cancel reply

Your email address will not be published. Required fields are marked *

Vul dit nog even in: * Time limit is exhausted. Please reload CAPTCHA.