Passing cgi parameters to script...

S

sophie_newbie

Is there any way that I can pass cgi parameters to my script locally,
before i upload it to the webserver, so that i can debug it.

Normally I would pass parameters like this:

www.webserver.com/script.cgi?TERM1=hello&FIELD1=TTL&TERM2=goodby&FIELD2=GOVT

The problem is that I get errors that do not show up when I run the
script locally and I do not have access to the error logs.

So is there a way I can pass the form values TERM1, FIELD1 etc to the
script without having to upload it to the server?
 
D

Diez B. Roggisch

sophie_newbie said:
Is there any way that I can pass cgi parameters to my script locally,
before i upload it to the webserver, so that i can debug it.

Normally I would pass parameters like this:

www.webserver.com/script.cgi?TERM1=hello&FIELD1=TTL&TERM2=goodby&FIELD2=GOVT

The problem is that I get errors that do not show up when I run the
script locally and I do not have access to the error logs.

So is there a way I can pass the form values TERM1, FIELD1 etc to the
script without having to upload it to the server?


You might think of using CGIHttpServer to test your scripts in a
server-environment - while still being local.

Regards,

Diez
 
M

Mike Meyer

sophie_newbie said:
Is there any way that I can pass cgi parameters to my script locally,
before i upload it to the webserver, so that i can debug it.

Normally I would pass parameters like this:

www.webserver.com/script.cgi?TERM1=hello&FIELD1=TTL&TERM2=goodby&FIELD2=GOVT

CGI paramaters are set in the environment. On Unix, in an sh-like
shell, do:

QUERY_STRING='TERM1=hello&FIELD1=TTL&TERM2=goodby&FIELD2=GOVT' www.webserver.com/script.cgi

Depending on the package you're using for handling CGI, you may need
to set other CGI parameters as well. The traceback from trying this
should give you a KeyError naming the environment variable it's
looking for.

<mike
 
K

Kent Johnson

Diez said:
You might think of using CGIHttpServer to test your scripts in a
server-environment - while still being local.

Which can be as simple as typing
python -c "import CGIHTTPServer; CGIHTTPServer.test()"

from the command line in the root dir of your site (the dir that
contains the cgi-bin dir).

Kent
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top