I'm trying to use shell_exec(), exec(), system(), or any function of that nature to execute a command, but it only seems to want to execute commands that are built-in to the Bash shell. For example, this works fine:
Code: Select all
$command = "cat /etc/passwd";
$myOutput = shell_exec($command);
echo "<pre>".$myOutput."</pre>";
Code: Select all
$command = "/usr/bin/java -version";
$myOutput = shell_exec($command);
echo "<pre>".$myOutput."</pre>";
Code: Select all
$command = "/usr/bin/java -version";
$myOutput = system($command, $rc);
echo "$rc";
echo "<pre>".$myOutput."</pre>";
I have safe mode turned off, and safe_mode_exec_dir = /usr/local/php/bin. I tried putting scripts into this directory and executing them but that doesn't work either.
Am I missing something here? Why can't I invoke a script or other executable from my php code?