If I run
which java
from the command line I get the proper input (/usr/java/.../bin/java). However if I run it in a php script:
<?
echo 'java. ' . shell_exec('which java');
echo 'ls. ' . shell_exec('which ls');
?>
nothing gets printed out for which java but I get the proper results for which ls...