Running Jaqueline's CGI tutorial in JaguarPC
J. Landman Gay
jacque at hyperactivesw.com
Sat Dec 3 12:36:38 CST 2005
Alejandro Tejada wrote:
> Hi all,
>
> yesterday, i was testing
> Jaqueline's CGI tutorial
> in my website in JaguarPC.
>
> Jaqueline had made a great
> service for the developer
> community, publishing this
> tutorial in his website.
>
> Thanks again, Jaque! :-)
>
> i got mixed results, following
> the steps detailed, surely because
> my own particular configuration
> in my website.
>
> These examples works fine:
> 1- Visitor counter
> 2- Random content
> <http://www.hyperactivesw.com/cgitutorial/scripts2.html>
>
> but scripts that try
> to load a file by reference
> or access a stack
> do not work.
>
> Trying to load a reference of
> the file like this produces an error:
>
> -- start of example from CGI tutorial
>
> <http://www.hyperactivesw.com/cgitutorial/scripts2.html>
> put "tipTemplate.txt" into theTemplateFile
> if there is no file theTemplateFile then
> put "Error: template missing" into theData
> else
> put url ("file:"&theTemplateFile) into theData
>
> -- end of example from CGI tutorial
>
> But... reading directly a file content
> and putting it in a variable,
> works just fine:
>
> #!Revolution
>
> on startup
> put url "file:tipTemplate.txt" into theData
> put offset("[*]",theData) into theStartChar
> put url "file:tips.txt" into theTFile
> put any line of theTFile into char theStartChar to
> theStartChar+2 of theData
>
> # write minimal set of HTTP headers to stdout
> put "Content-Type: text/html" & cr
> put "Content-Length:" && the length of theData & cr
> & cr
> put theData
> end startup
>
> Why this happen in my website?
> Looks like the file reference
> it's lost or misinterpreted by
> the engine. i suspect that something
> similar happens when the engine try
> to load a stack, like the "adresses.rev"
> used in the example of this page:
>
> <http://www.hyperactivesw.com/cgitutorial/scripts3.html>
>
> How could i debug this script and know
> exactly what is the command or function
> that fails when reading or writing to
> reference files or stacks?
>
> Notice that i could read and write to
> text files inside the CGI folder.
Where is the tipTemplate file located? If you have it in the cgi folder,
it should work. You must make sure you have set its permissions to 755.
If you want to keep the text file in a different folder, you must allow
permissions for all the containing folders. This is considered a high
security risk. I recommend keeping all the files together inside the cgi
folder only.
If you do keep the files outside the CGI folder, you may need to provide
a full file path to them. Just "template.txt" isn't enough.
To debug, read the part of the tutorial that explains how to see the
system log. That is where the error messages will be, and they can tell
you why the file will not load. On OS X the server log is in
/private/var/log/httpd/, and you can open it in any text editor. You can
also read the system log in the Console application that is in the OS X
Utilities folder. It is handy to keep the Console application open while
you test your CGI. New entries to the system log show up dynamically as
you are working.
By the way, "there is no file" is valid syntax, so I don't think that is
the problem. The system log should give you an idea though. It reports
both Revolution errors and OS/CGI errors.
--
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the metacard
mailing list