我在.bash_profile和环境文件中设置了JAVA_HOME。 当在 CentOS 中通过终端运行 Gradlew 时 建立 seccessfull,但是当 PHP exec 运行相同的命令时JAVA_HOME错误
$command = "$path/gradlew -c $path/settings.gradle assembleRelease";
exec($command, $output, $code);
错误:"请将环境中的JAVA_HOME变量设置为匹配">
通过在命令字符串中发送java_home修复
$javaHome = "JAVA_HOME=/opt/jdk1.8.0_161";
$command = "$javaHome $path/gradlew -c $path/settings.gradle assembleRelease";
exec($command, $output, $code);