ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I want to include the output of the mailgraph perl script (mailgraph.cgi) in my php web. The graphics I need are generated by passing a "QUERY_STRING" to the script, so I would get the output by typing
Code:
export QUERY_STRING="0-n"
./mailgraph.cgi
in the shell.
That graphics should be included in a web that is used by several users simultaneously so I'm looking for a shell command that is executed within PHP and passes a QUERY_STRING value without using the environment variable so the different users don't get in each others way.
Do you know how I can solve that?
Thank you in advance!
Last edited by XavierP; 10-13-2008 at 04:20 AM.
Reason: Moved to Programming
thank you for your answer, but that seems not to work (or I am doing something wrong):
Code:
mail:/usr/lib/cgi-bin# ./mailgraph.cgi?n-0
bash: ./mailgraph.cgi?n-0: No such file or directory
mail:/usr/lib/cgi-bin# perl mailgraph.cgi?n-0
Can't open perl script "mailgraph.cgi?n-0": No such file or directory
mail:/usr/lib/cgi-bin#
When CGI scripts are executed from a Web server like Apache, each "instance" of the script is executed within the context of a newly-created shell. Each shell has its own environment, which will be unique from all other instances. Therefore, you have nothing to fear - multiple users will be properly handled.
The solution I presented will work as well - you have to escape the special meaning of the "?" character when you try to run your command at the prompt:
mail:/usr/lib/cgi-bin# ./mailgraph.cgi\?n-0
You cgi script will have to parse the argument string properly, but if you've been parsing GET input from web forms, the code should already be in place to do that.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.