On Wed, Apr 16, 2008 at 9:58 AM, Burt Crépeault <
email@hidden> wrote:
Hi all,
I'm using the exec() command in PHP5 to run some Perl scripts external to my web application. I noticed that the environment variables are not always set properly in the shell created by exec(). For example, if I run the following PHP script through apache just to list the content of environment variables, I get these results:
<?php
exec("export", $output);
print "<pre>";
var_dump($output);
print "</pre>";
?>
array(4) {
[0]=>
string(13) "export OLDPWD"
[1]=>
string(43) "export PATH="/usr/bin:/bin:/usr/sbin:/sbin""
[2]=>
string(41) "export PWD="/Library/WebServer/Documents""
[3]=>
string(16) "export SHLVL="1""
}Some critical environment variables are missing such as TMPDIR and PERL5LIB and so on. I found a workaround, namely using the putenv() command at the beginning of my script, like this:
putenv("PATH={$_ENV["PATH"]}:$dir1:$dir2");
putenv("PERL5LIB=$dir3:$dir4");
putenv("TMPDIR=/private/tmp");
However, I'd like to set these variables once and for all in a profile somewhere and not have to deal with them in the script itself.
So my question is: where is that profile for the _www user (or any user running under apache)?
--
Burt Crépeault
Research Assistant
Centre de Recherche de l'Université Laval - Robert-Giffard
Québec, Canada
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Web-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/web-dev/email@hidden
This email sent to email@hidden