"; when I run through command prompt " /> "; when I run through command prompt " /> "; when I run through command prompt "/>

How can I use getenv in PHP?

421 Views Asked by At

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 :

0

There are 0 best solutions below