Calling (non-php) scripts from inside PHP

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
In my php page I am calling a Python cgi. The problem is that
originally the Python script was being called directly and it could
access the environment variables that were being set. Now since the
php script is being called first it has access to the environment
variables, but the Python script does nt.

How can I forward the variables or call the Python script in such a
way where it can access those variables?

These are the type of environment variables I am talking about

In my php script (which is a web page) I was calling the Python cgi
like this.
$output=shell_exec("../cgi-bin/setaccess.cgi"." 2>&1");  //system call
print $output;

Re: Calling (non-php) scripts from inside PHP

Greetings, Anthony Smith.
In reply to Your message dated Wednesday, December 12, 2007, 22:30:55,

Quoted text here. Click to load it

If it is really CGI script, why not call it using CGI? Direct URL-include or
some dance with cURL or socket read?

Aside from that, You can try use putenv() to temporarily alter the environment
before starting external application. Altered environment should be passed to
it, I guess.


Re: Calling (non-php) scripts from inside PHP

Quoted text here. Click to load it

This might work:



Re: Calling (non-php) scripts from inside PHP

Quoted text here. Click to load it

I ended up doing this:
header("Location: ");

In the PHP file I can have other code, but as long as it does not have
any header information, I might be fine. I basically needed the
ability to set the cookie and put things into the session.

Site Timeline