There are several scenarios for which specific paths must be set in the environment. I want to change my path to include these locations. These are the places that I want to add to my exec path.
$JAVA_HOME = "/usr/java/jdk1.6.0_31";
$ANT_HOME = "/usr/apache-ant-1.8.3";
$ANT_BIN = "$ANT_HOME/bin";
$JAVA_BIN = "$JAVA_HOME/bin";
$ADDPATH=$JAVA_HOME . ":" . $ANT_HOME . ":" . $ANT_BIN .":" . $JAVA_BIN . ":" . $PATH;
And I used putenv
putenv("JAVA_HOME=" . $JAVA_HOME);
putenv("ANT_HOME=" . $ANT_HOME);
putenv("ANT_BIN=" . $ANT_BIN);
putenv("JAVA_BIN=" . $JAVA_BIN);
putenv("PATH=".$_ENV["PATH"].":".$ADDPATH);
However when i do
echo getenv("PATH");
I get
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
I have two requests: (a) How to set the path variable to the values I want (b) Is there a way (or location) to add these locations to the component of the server environment (in php.ini or apache configurations), and Do not use a script to make these changes.
source
share