Passing cgi parameters to script...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sophie_newbie

    #1

    Passing cgi parameters to script...

    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:



    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?

  • Diez B. Roggisch

    #2
    Re: Passing cgi parameters to script...

    sophie_newbie wrote:
    [color=blue]
    > 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:
    >
    >[/color]
    https://www.webserver.com/script.cgi...by&FIELD2=GOVT[color=blue]
    >
    > 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?[/color]


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

    Regards,

    Diez

    Comment

    • Mike Meyer

      #3
      Re: Passing cgi parameters to script...

      "sophie_new bie" <paulgeeleher@g mail.com> writes:[color=blue]
      > 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:
      >
      > https://www.webserver.com/script.cgi...by&FIELD2=GOVT[/color]

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

      QUERY_STRING='T ERM1=hello&FIEL D1=TTL&TERM2=go odby&FIELD2=GOV T' 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
      --
      Mike Meyer <mwm@mired.or g> http://www.mired.org/home/mwm/
      Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.

      Comment

      • Kent Johnson

        #4
        Re: Passing cgi parameters to script...

        Diez B. Roggisch wrote:[color=blue]
        > sophie_newbie wrote:
        >[color=green]
        >>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.[/color]
        >
        > You might think of using CGIHttpServer to test your scripts in a
        > server-environment - while still being local.[/color]

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

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

        Kent

        Comment

        Working...