CGI - OS X problem

Ken Ray kray at sonsothunder.com
Tue Oct 17 01:38:18 EDT 2006


On 10/17/06 12:18 AM, "Sarah Reichelt" <sarah.reichelt at gmail.com> wrote:

> Hi All,
> 
> I'm just getting started with CGI under OS X. Many thanks to Jacque
> for the wonderful tutorial which has got me a long way.
> 
> Now I have a problem because my cgi script has to access a folder in
> the Documents folder of the computer running the script. When testing
> the Rev stack, I had no problem because I used
> specialFolderPath("docs") and got there every time. In the cgi, this
> function call gives an error.
> 
> Trying to use $USER or $HOME to get enough data to build the folder
> path myself doesn't work either. It doesn't cause an error, but
> doesn't give my any data.
> 
> So does anyone know how I can get the path to the Documents folder, or
> the current users name when running Rev as a cgi?

Well, I don't think you can get that information from the CGI - I ran a
test, and although there were many globals available, none of them
identified the current logged in user.

I modified my "Hello.cgi" to return the list of globals for my OS X machine,
and here's what I got:

$GL_RESOURCES=/usr/libexec/oah/Shims
$DYLD_NO_FIX_PREBINDING=1
$SCRIPT_NAME=/cgi-bin/hello.cgi
$REQUEST_URI=/cgi-bin/hello.cgi
$REQUEST_METHOD=GET
$SERVER_PROTOCOL=HTTP/1.1
$GATEWAY_INTERFACE=CGI/1.1
$SERVER_SOFTWARE=Apache/1.3.33 (Darwin)
$SERVER_SIGNATURE=[ADDRESS]Apache/1.3.33 Server at 127.0.0.1 Port
80[/ADDRESS]

$SERVER_PORT=80
$SERVER_NAME=127.0.0.1
$SERVER_ADMIN=[no address given]
$SERVER_ADDR=127.0.0.1
$SCRIPT_URL=/cgi-bin/hello.cgi
$SCRIPT_URI=http://127.0.0.1/cgi-bin/hello.cgi
$SCRIPT_FILENAME=/Library/WebServer/CGI-Executables/hello.cgi
$REMOTE_PORT=54754
$REMOTE_ADDR=127.0.0.1
$PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/libexec:/System/Library/CoreService
s
$HTTP_USER_AGENT=Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US;
rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7
$HTTP_KEEP_ALIVE=300
$HTTP_HOST=127.0.0.1
$HTTP_CONNECTION=keep-alive
$HTTP_CACHE_CONTROL=max-age=0
$HTTP_ACCEPT_LANGUAGE=en-us,en;q=0.5
$HTTP_ACCEPT_ENCODING=gzip,deflate
$HTTP_ACCEPT_CHARSET=ISO-8859-1,utf-8;q=0.7,*;q=0.7
$HTTP_ACCEPT=text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,
text/plain;q=0.8,image/png,*/*;q=0.5
$DOCUMENT_ROOT=/Library/WebServer/Documents
$OAH750_CFG_FU_STACK_SIZE=0
$0=/Library/WebServer/CGI-Executables/hello.cgi


My user name on this machine is "kenray", and you can see that nowhere does
this appear. But perhaps one of these might help you...

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com




More information about the Use-livecode mailing list