There should be no reason to use the -c in a shebang line. -c suppresses the prompt, but that is suppressed anyway when newLISP is executed via a script, so -c in a shebang line is redundant.
There also should be no reason to use -w in the shebang line. The effect of it seems to be different on different OS, e.g. on Mac OS X, newLISP tries to find the rest of the script file, after the shebang file in the -w directory, which is the reason I recommended to use the full pathname. I have meanwhile tried this on FreeBSD, where this is different and behaves more like Linux.
But I was not aware, this is about CGI processing. To make a long story short:
(1) don't use any -c or -w in the shebang line of your CGI script. Let Apache handle the way it switches working directories. Your script automatically will see the directory of the script as the current directory. Your scripts will behave like any other Perl or Python CGI scripts regarding directories.
(2) You can refer to scripts below the current directory in a relative fashion, etc. (read-file "subdir/mydata.dat") would read the file below the directory, where the cgi scripts is. Use the function (real-path) as a quick way to find out the current directory:
Code: Select all
#!/usr/bin/newlisp
(print "Content-type: text/html\r\n\r\n")
(println (real-path))
(exit)
(3) let all newLISP CGI scripts have the extension .cgi, without something else after the .cgi. If those CGI scripts handle data files, they can of course have any other extension, but the scripts executed by Apache, should only have .cgi or whatever Apache is configured too.
(4) make sure your .cgi script files have the right permissions and the right owner, as usual with any cgi scripting.