Hi Sandip! Will this actually work from a shell script? Assuming that Manish was running it in a subshell, i.e.
#!/bin/sh export a="boo" Doesn't "export" export a variable to the environment of the shell within which it's run? Child processes, of course inherit environment variables, but how would one pass it onto a parent? Also, even if it does work for the C program, assuming it's running in the same script, IMHO, it wouldn't work for the PHP script unless he's running the php binary under the same shell or the first httpd listener thread/process under the same shell... In Apache, mod_php, mod_cgid, mod_cgi fix up the environment for you before they do an execve+fork, which is why you can use them from PHP. So my bets would be: part 1- C program - no it won't work, and I don't know how to make it work. The first term that comes to mind is IPC and my mind jumps out of my skull and totters away every time I try to think any further. part 2- PHP script- um... ditto... Sapan On Mon, Apr 08, 2002 at 06:13:42PM +0530, Sandip Bhattacharya wrote: // do an EXPORT in the shell script or the environment variable value // won't be available after the shell script terminates. // // > MAILVAR="TEST MAIL VAULE" // EXPORT MAILVAR // // - Sandip // // // On Mon, Apr 08, 2002 at 05:15:44PM +0530, Manish K Arya spoke out thus: // > hi // > i m trying to get value of a environment var in C and php which was set in shell script // > // > #test.sh // > MAILVAR="TEST MAIL VAULE" // > // > /*test.c*/ // > int main() // > { // > char *email; // > email=getenv("MAILVAR"); // > printf("%s",email); // > } // > // > <?php // > /*test.php*/ // > $email=getenv("MAILVAR"); // > echo "$email"; // > ?> // > // > i m getting NULL output in both programs // > // > pls advise // > // > --- // > Manish Kumar Arya // > // > // > // > See Dave Matthews Band live or win a signed guitar // > http://r.lycos.com/r/bmgfly_mail_dmb/http://win.ipromotions.com/lycos_020201/splash.asp // > // > ================================================ // > To subscribe, send email to [EMAIL PROTECTED] with subscribe in subject header // > To unsubscribe, send email to [EMAIL PROTECTED] with unsubscribe in subject header // > Archives are available at http://www.mail-archive.com/ilugd%40wpaa.org // > ================================================= // // -- // Sandip Bhattacharya // Mindframe Software // Work: sandip @ mindsw.com, http://www.mindsw.com // Play: sandipb @ bigfoot.com, http://www.sandipb.net // ----------------------------------------------- // // ================================================ // To subscribe, send email to [EMAIL PROTECTED] with subscribe in subject header // To unsubscribe, send email to [EMAIL PROTECTED] with unsubscribe in subject header // Archives are available at http://www.mail-archive.com/ilugd%40wpaa.org // ================================================= // ================================================ To subscribe, send email to [EMAIL PROTECTED] with subscribe in subject header To unsubscribe, send email to [EMAIL PROTECTED] with unsubscribe in subject header Archives are available at http://www.mail-archive.com/ilugd%40wpaa.org =================================================