The question is a bit old, but for those who experience this problem can try to set the environment variables of direct on the server. PHP uses the putenv () function.
Example:// Set Variable Enviromental
$JAVA_HOME = "/usr/lib/jvm/java-8-oracle"; $ANDROID_HOME = "/opt/android-sdk-linux"; $PATH="$JAVA_HOME/bin:/usr/local/bin:/usr/bin:/bin:$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools:$ANDROID_HOME/build-tools/24.0.0-preview"; putenv ("JAVA_HOME = $JAVA_HOME"); putenv ("PATH = $PATH");
manpreet
Best Answer
2 years ago
I want to execute following command on my Ubuntu server using php:
The above command is to create an Android app project. So when I enter this command on my terminal then it works fine, but when I execute it via PHP:
When I run my PHP script I get the following output:
Why it works when I enter manually in terminal (from user 'ashish' account) but not with php? my apache user and group is same (ashish). Any help will be appreciated :)