I have written the following code: test.php
$java_path=getenv("JAVA_HOME");
echo 'Java Path : '.$java_path ."<br>";
when I run through command prompt (Ubuntu terminal) like:
>php test.php
Output:
Java Path : /opt/jdk1.8.0_161
I get the expected output, but when I run it through browser (Firefox),
http://localhost/test.php
I get empty value for Java Path. Output: Java Path :