tags:

views:

35

answers:

2

I have written a C CGI executable, and I want it to be able to retrieve the PATH_INFO from Apache. For example, if I have the compiled C file as /var/www/html/file, and I request http://localhost/file/pathinfo, How do I get the pathinfo portion?

If you have any idea, please help. Thanks in advance!

+2  A: 

All the CGI variables are stored in the environment. There you will find a PATH_INFO variable.

spoulson
+2  A: 

This (and a great deal of other information) is available as environment variables. This shell script, run as a CGI script in your environment, will dump everything you can get at:

#! /bin/sh
printf "Content-Type: text/plain\n\n"
printenv

From your C program, access the variables using getenv() as usual.

Zack
Thanks. I'm using getenv("PATH_INFO");
Tech163