{"id":152,"date":"2012-12-18T19:28:24","date_gmt":"2012-12-18T19:28:24","guid":{"rendered":"http:\/\/arnoldvanhofwegen.com\/blog\/?p=152"},"modified":"2012-12-18T08:19:31","modified_gmt":"2012-12-18T08:19:31","slug":"simple-red-cgi-scripting-possible","status":"publish","type":"post","link":"https:\/\/arnoldvanhofwegen.com\/blog\/simple-red-cgi-scripting-possible\/","title":{"rendered":"Simple Red CGI scripting possible"},"content":{"rendered":"<p>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.<\/p>\n<p>This is a small tutorial of how this can be done.<\/p>\n<p>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.<\/p>\n<p>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.<\/p>\n<p>First you create a script that later needs to be compiled:<\/p>\n<p><code><br \/>\n        Red [ \"My First Red CGI testscript\"<br \/>\n        &nbsp;&nbsp;&nbsp;&nbsp;file: %myredcgi.red<br \/>\n        ]<\/p>\n<p>        print \"Content-Type: text\/html^\/\"  ;-- Required Page Header<\/p>\n<p>        html: \"&lt;html&gt;&lt;body&gt;\"<br \/>\n        code: \"&lt;h2&gt;Welcome Red CGI!!&lt;\/h2&gt; The world has been waiting for you!&lt;\/body&gt;&lt;\/html&gt;\"<\/p>\n<p>        html: append html code<br \/>\n        print html<br \/>\n<\/code><\/p>\n<p>After this you will need to cross-compile your script to create a Linux executable.<br \/>\nYou then have change the file extension to .cgi.<\/p>\n<p>Upload the script to your (Apache) server and be sure to give it executable rights. <\/p>\n<p>Probably that is all and you can test your script in the browser.<\/p>\n<p>If you still encounter problems, the reason may lie in your .htaccess file on the server or in the directory above your script.<br \/>\nThis has to contain a line that says <\/p>\n<p><code>Options +ExecCGI<\/code><\/p>\n<p>You can find more information on Red on http:\/\/red-lang.org\/ and your version of REBOL to use on<br \/>\nhttp:\/\/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<\/p>\n<p>Good luck and very much fun creating your Red CGI scripts!!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A really short how-to make a working CGI script using Red <a href=\"https:\/\/arnoldvanhofwegen.com\/blog\/simple-red-cgi-scripting-possible\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"gallery","meta":{"footnotes":""},"categories":[5,6],"tags":[],"_links":{"self":[{"href":"https:\/\/arnoldvanhofwegen.com\/blog\/wp-json\/wp\/v2\/posts\/152"}],"collection":[{"href":"https:\/\/arnoldvanhofwegen.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/arnoldvanhofwegen.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/arnoldvanhofwegen.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/arnoldvanhofwegen.com\/blog\/wp-json\/wp\/v2\/comments?post=152"}],"version-history":[{"count":9,"href":"https:\/\/arnoldvanhofwegen.com\/blog\/wp-json\/wp\/v2\/posts\/152\/revisions"}],"predecessor-version":[{"id":161,"href":"https:\/\/arnoldvanhofwegen.com\/blog\/wp-json\/wp\/v2\/posts\/152\/revisions\/161"}],"wp:attachment":[{"href":"https:\/\/arnoldvanhofwegen.com\/blog\/wp-json\/wp\/v2\/media?parent=152"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/arnoldvanhofwegen.com\/blog\/wp-json\/wp\/v2\/categories?post=152"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/arnoldvanhofwegen.com\/blog\/wp-json\/wp\/v2\/tags?post=152"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}