I have write a simple CGI today,that was my first time writen and successful running on my laptop.This is my notes that you probably could take a look.It's quite easy more than imagine.
you need 2 tools if you want to write a CGI in scheme:apache and plt-scheme.
Firstable,download the apache server here.Then go Installation that follow steps and run the command on terminal:
tar -zxvf httpd-2.0.63.tar.gz
mv httpd-2.0.63 apache
cd apache
./configure --prefix=/usr/local/apache2 --enable-module=so
make
make install
"--enable-module=so" means that your apache will support DSO capabibliy.
ok.There's a last thing you have to do that it's configurate your httpd.conf file:
AddHandler cgi-script .cgi .scm
Now you got your own~Then you can go to install mzscheme.(read the installation document)
put a file which named of hello.scm in /usr/local/apache2/cgi-bin,the hello.scm file's src:
#!/bin/sh
":"; exec /usr/local/plt/bin/mzscheme -rq $0 "$@"
(display "content-type: text/plain")
(newline)
(newline)
(display "Hello,newbie Schemer!")
Now,use your browser to visit: http://127.0.0.1/cgi-bin/hello.scm
Reference:
CGI programming in Scheme by Hong Feng
Teach Yourself Scheme in Fixnum Days by Dorai Sitaram
No comments:
Post a Comment