build-markup and Apache set-up?
[1/7] from: petr:krenzelok:trz:cz at: 2-Oct-2002 22:25
Hi,
so we've got 'build-markup function. It is said to work just like php
does. In a few days, I am supposed to try the concept together with my
friend. We need following - he does graphics and html layout, I do
script. Now how to combine our work?
The work of designer and scripter is the same for PHP and Rebol now, but
the difference comes in following areas:
- PHP is precompiled with Apache in most cases, so let's assume it is
so. The only thing the team needs is to put resulting page wherever they
want into their web-site structure
- now REBOL - no Apache module, only X time slower CGI interface is
left. CGI scripts are supposed to be placed mostly into /cgi-bin or so
subdirectory, but I want such page to be placed everywhere in web-site
directory structure - simply an equivalent of PHP. How to set apache
for that?
- so - next point - what form is my friend supposed to upload resulting
page in? Let's even assume he names his creation some-page.cgi and puts
it into /cgi-bin directory. How am I supposed to start rebol now to let
my RSPs to be translated (code evaluated)?
#/usr/bin/rebol -cs build-tag what? How do I specify the input (self?)
Maybe I am missing something here ....
Thanks for any prompt help, now the only part left is to get free
implementation of fast-cgi ;-)
-pekr-
[2/7] from: al:bri:xtra at: 3-Oct-2002 9:34
pekr wrote:
> Thanks for any prompt help, now the only part left is to get free
implementation of fast-cgi ;-)
Be sure to use Rebol/Base, as it's noticably faster than Core or View.
> How am I supposed to start rebol now to let my RSPs to be translated (code
evaluated)?
> #/usr/bin/rebol -cs build-tag what? How do I specify the input (self?)
You'll need to write a little script in the above command line. Something
like:
#! usr/bin/rebol -cs "build-markup %Page.rsp"
Where "%Page.rsp" is the filename of the page the above line is in.
I think that should do it.
Andrew Martin
ICQ: 26227169 http://valley.150m.com/
[3/7] from: gscottjones:mchsi at: 2-Oct-2002 16:25
Hi, Petr,
From: "Petr Krenzelok"
> so we've got 'build-markup function. It is said to work just
> like php does. In a few days, I am supposed to try the
<<quoted lines omitted: 6>>
> assume it is so. The only thing the team needs is to put
> resulting page wherever they want into their web-site structure
It depends on the platform as to how this is accomplished. You may have to
do some poking around to find the best set-up for Windows-based Apache
servers.
That said, you will need to configure Apache to recognize PHP pages, and to
decide which extension represents the best default. For eaxmple, in
httpd.conf:
<IfModule mod_dir.c>
DirectoryIndex index.html index.shtml index.php index.r
</IfModule>
If a Url only specifies a path, and not page, the above entry tells Apache
in which order to search for the default. You can decide on the name and
the extension and any order you wish.
If you decide to load the PHP module on a Windows platform, then you will
need something like the following in httpd.conf
LoadModule php4_module c:/php/sapi/php4apache.dll
AddType application/x-httpd-php .php .php4 .php3 .phtml
AddType application/x-httpd-php-source .phps
And finally you do have to configure PHP to work with Apache. On Windows,
the php.ini file is stored under \windows directory. The defaults
frequently work now.
Outside of these provisos, then yes, generally you can put .php pages in any
directory.
> - now REBOL - no Apache module, only X time slower
> CGI interface is left.
Many major web hosting services still choose to use php solely as a cgi,
because they do not want to risk bringing down a shared server. In this
case, the two solutions may be very comparable.
> CGI scripts are supposed to be placed mostly into
> /cgi-bin or so subdirectory,
A script alias should be set up in the httpd.conf file for apache, and might
look something like this:
ScriptAlias /cgi-bin/ "/path/to/safe-directory/cgi-bin/"
Ideally this directory should be *off* the path of the www pages. It's a
security thing.
> but I want such page to be placed everywhere in
> web-site directory structure - simply an equivalent of
> PHP. How to set apache for that?
Early in the httpd.conf file, there is a place to set default permissions
for all directories. It looks something like:
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
Later, following the setting of the document root, you set the permissions
on that directory. That line will need to include ExecCGI, and may look
something like the following:
Options Indexes FollowSymLinks Includes ExecCGI MultiViews
Next, you will need an AddHandler line to tell Apache which extensions are
executable. Normally, you might see
AddHandler cgi-script .cgi
You can change this to any extension you wish, or add additional lines with
additional extensions:
AddHandler cgi-script .r
You can choose any extension you want, as long as it doesn't conflict with
another type.
Alternatively, you can specify fully executable directory paths as seen
below. I've only played with this just a bit, and don't recall much more
about it.
<Location /local>
ForceType application/x-httpd-r
</Location>
> - so - next point - what form is my friend supposed to
> upload resulting page in?
ASCII format and with what ever extension you have chosen from above.
> Let's even assume he names his creation some-page.cgi
> and puts it into /cgi-bin directory. How am I supposed to
> start rebol now to let my RSPs to be translated (code evaluated)?
The pages that run on REBOL will still need the #! path. Apache knows how
to find REBOL based on this, and it knows the file is "executable" based on
the extension.
By the way, it case it isn't obvious, all the executable pages will still
need a chmod to 755 on any *nix platform.
> #/usr/bin/rebol -cs build-tag what? How do I specify the input (self?)
It would be:
#!/usr/bin/rebol -cs
But I am not following the second half of this sentence.
Good luck. Hopefully I didn't make any typos.
BTW, I would highly recommend setting up a local development platform before
uploading anything to a website. It is just a lot easier to work with.
--Scott Jones
[4/7] from: petr:krenzelok:trz:cz at: 3-Oct-2002 0:16
Hello,
one reply to both Scot and Martin - thanks for your answers ... very
informative - some of the stuff you described I know already, I have got
even fast-cgi running ....
Andrew Martin wrote:
>pekr wrote:
>
>>Thanks for any prompt help, now the only part left is to get free
>>
>>
>implementation of fast-cgi ;-)
>
>Be sure to use Rebol/Base, as it's noticably faster than Core or View.
>
but then I will miss 'build-markup function ;-) (just kidding)
>>How am I supposed to start rebol now to let my RSPs to be translated (code
>>
<<quoted lines omitted: 7>>
> #! usr/bin/rebol -cs "build-markup %Page.rsp"
>Where "%Page.rsp" is the filename of the page the above line is in.
How will web development environment behave, if I put above line on the
first line of the page? Will it break anything? Will my friend need to
comment that line while still working upon site design, and uncomment
right before he is ready to upload it? Or it does not affect html
display at all?
Thanks a lot, folks,
-pekr-
[5/7] from: brett:codeconscious at: 3-Oct-2002 8:11
> Be sure to use Rebol/Base, as it's noticably faster than Core or View.
REBOL/Base is currently an alpha version and as far as I know available on
Windows only.
Maybe not a good idea to use it.
I suggest Petr, that you decide which particular Core/Command you'll use on
your ultimate target machine and test all your scripts against that so that
you will know how it behaves.
Regards,
Brett.
[6/7] from: andreas:bolka:gmx at: 2-Oct-2002 23:58
Wednesday, October 2, 2002, 9:25:06 PM, Petr wrote:
> - PHP is precompiled with Apache in most cases, so let's assume it
> is so. The only thing the team needs is to put resulting page
<<quoted lines omitted: 4>>
> web-site directory structure - simply an equivalent of PHP. How to
> set apache for that?
PHP can run in two modes:
- as native module
- in cgi redirection mode
It actually should be possible, two let RSPs behave quite similar to
PHP pages.
CGI redirection mode is actually quite interesting:
- you register a MIME type with an extension, e.g.
application/x-httpd-rebol with .r or .rsp
- then you tell apache, that whenever an resource of type
application/x-httpd-rebol gets requested, it should take the file and
pipe it thru an CGI.
so you'll need some components:
- an http-accessible directory where CGIs can be executed (usually
cgi-bin)
- a small rebol CGI, that reads everything it gets from stdin,
processes this with build-markup and 'prints the result to stdout
- an appropriate apache configuration to do CGI redirection of all
.rsp files to this CGI
i assume that you've got a place where to put CGIs. Now add the
following lines to your apache config:
AddType application/x-httpd-rebol .rsp
Action application/x-httpd-rebol "/cgi-bin/rsp.cgi"
Write the small REBOL CGI outlined before, and place it into your
cgi-bin directory (using the extension .cgi).
Give it a try and do not hesitate to ask if problems arise :)
--
Best regards,
Andreas mailto:[andreas--bolka--gmx--net]
[7/7] from: al::bri::xtra::co::nz at: 3-Oct-2002 11:25
> >You'll need to write a little script in the above command line. Something
> >like:
<<quoted lines omitted: 5>>
> >
> How will web development environment behave, if I put above line on the
first line of the page? Will it break anything? Will my friend need to
comment that line while still working upon site design, and uncomment right
before he is ready to upload it? Or it does not affect html display at all?
I think it won't affect the HTML. Easiest way is to not include in the
original HTML source. Write a little Rebol script to insert this line to
every HTML page just before it's sent to the server.
Andrew Martin
ICQ: 26227169 http://valley.150m.com/
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted