I have a command I have tested in the terminal and it works fine, but when I call the command in my script to display the output on the browser it doesn't seem to work. My command takes time for it to display the output in the terminal would this be a contribution why its not displaying on the browser.
set_time_limit (0);
echo '<pre>';
$output=array();
$last_line = system('cat /home/me/dev/test/working/test_string.txt | java -jar /home/simon/logstash/build/logstash-1.1.10.dev-monolithic.jar agent -f /home/me/dev/test/working/my_itch_con.config',$output);
echo '</pre>';
echo "Complete";
print_r($output);
echo "<br>";
Confirm whether you disable system
function in php.ini in disable_function
block
When set error_reporting(E_ALL) to display all error
Parameters to the system
(It will not show you the output, it just return you the status of the command)
command
The command that will be executed.
return_var
If the return_var argument is present, then the return status of the executed command will be written to this variable.
////////////////////////////////......................................................................................///////////////////////////////////////////
Use `exec` command instead
command
The command that will be executed.
output
If the output argument is present, then the specified array will be filled with every line of output from the command. Trailing whitespace, such as , is not included in this array. Note that if the array already contains some elements, exec() will append to the end of the array. If you do not want the function to append elements, call unset() on the array before passing it to exec().
return_var
If the return_var argument is present along with the output argument, then the return status of the executed command will be written to this variable.
EG:-
exec('whoami', $test, $arr);
print_r($test);
In browser it o/p
Array ( [0] => nt authority\system )
For more info