I'm not able to print kubectl output on chrome web browsers using php shell_exec() function.
i'm trying to display output of shell_exec() on my web browser. The php code is working fine when i run on terminal but as i run on chrome then only output2 is printing. But i need to print output1 as well.
Can any one help to resolve this issue? Running my status.php with below on CentOS Linux release 7.9.2009 (Core)
cmd: php status.php
My status.php page:
<?php
$ns = "bind";
echo $ns;
$cmd = "kubectl --kubeconfig /var/www/html/config get pod -n $ns";
$cmd2= "ls -lrth";
echo "<pre>";
$output1 = shell_exec($cmd);
$output2 = shell_exec($cmd2);
echo $output1; // Printing this output value on terminal but not printing on web browser
echo $output2;
echo "</pre>"; // Printing this output2 value on terminal as well web browser
echo "after shell_exce funtion"
?>
--
My OS is CentOS Linux release 7.9.2009 (Core) cat /etc/redhat-release
my php version:
PHP 5.4.16 (cli) (built: Apr 1 2020 04:07:17) Copyright (c) 1997-2013 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
i'm trying to display output of shell_exec() on my web browser. code is working fine when i run on terminal but as i run on chrome then only output2 is printing. But i need to print output1 as well.