I now have the script below. I was slightly surprised it didn't get an error as I had it load /usr/lib/ocaml/3.08.3/cgi/netcgi.cma, and the directory contains: cgi.a netcgi_env.cmi netcgi_fcgi.mli netcgi_jserv.cmi cgi.cma netcgi_env.mli netcgi_jserv_ajp12.cmi netcgi_jserv.mli cgi.cmxa netcgi_fcgi_10.cmi netcgi_jserv_ajp12.mli netcgi.mli META netcgi_fcgi_10.mli netcgi_jserv_app.cmi netcgi_types.cmi netcgi.cmi netcgi_fcgi.cmi netcgi_jserv_app.mli netcgi_types.mli When I run it, I get a different and shorter error message: File "./demo.ml", line 35, characters 2-5: Syntax error The line in question is: | "1" -> "Yes" Is there some irritating little syntax error around line 35? -- #!/usr/bin/ocamlrun ocaml (* Change the directories as needed for your system. *) #directory "+pcre";; #load "pcre.cma";; #load "unix.cma";; #directory "+netstring";; #load "netstring.cma";; #directory "/usr/lib/ocaml/3.08.3/cgi/";; #load "netcgi.cma";; open Netcgi let text = Netencoding.Html.encode_from_latin1 (* This function encodes "<", ">", "&", double quotes, and Latin 1 characters as character entities. E.g. text "<" = "<", and text "ä" = "ä" *) (* Normally you would use a template system instead of this *) let html_page (cgi:cgi) title html = let out = cgi#out_channel#output_string in out "\n"; out ("\n