Dear all,
I need help urgently. Please review the below code.
<?php
error_reporting(E_ALL);
error_reporting(-1);
// phpinfo();
if(@exec('echo EXEC') == 'EXEC'){
echo 'exec works';
$ram=array();
echo exec("whoami");
exec("swetest -b$20.06.1998 -ut02.40.00 -p0123456789DAttt -eswe -house40,37,p -flsj -g -head", $ram);
//shell_exec("swetest -b$20.06.1998 -ut02.40.00 -p0123456789DAttt -eswe -house40,37,p -flsj -g -head");
print_r($ram);
}
?>
This Array Ram is empty Array{} when I run in in URL on browser but when I run the same PHP code on Putty Linux Terminal, it gives below result.
(
[0] => 69.4699711 0.9589330 12.7711722
[1] => 137.2047430 12.6210423 3.6491743
[2] => 57.5155629 2.0043804 12.4929126
[3] => 31.3153898 1.1640522 11.8892585
[4] => 64.9341541 0.7061970 12.6475111
[5] => 354.5698247 0.1370835 10.9268075
[6] => 29.0617305 0.1066860 11.8413060
[7] => 312.6691481 -0.0108831 9.4849388
[8] => 301.9767792 -0.0136113 9.0252288
[9] => 246.6157497 -0.0273073 7.0543078
[10] => 223.8406492 -0.0627669 6.1963588
[11] => 198.5784533 0.1113581 5.6143622
[12] => 155.4844488 -0.0261982 4.3224287
[13] => 155.4844488 -0.0261982 4.3224287
[14] => 155.4844488 -0.0261982 4.3224287
[15] => 78.0000935 4.3224287
[16] => 99.9959839 4.3224287
[17] => 121.4227768 4.3224287
[18] => 146.1570660 4.3224287
[19] => 178.0430227 4.3224287
[20] => 218.1001694 4.3224287
[21] => 258.0000935 4.3224287
[22] => 279.9959839 4.3224287
[23] => 301.4227768 4.3224287
[24] => 326.1570660 4.3224287
[25] => 358.0430227 4.3224287
[26] => 38.1001694 4.3224287
[27] => 78.0000935 4.3224287
[28] => 326.1570660 4.3224287
[29] => 328.3998653 4.3224287
[30] => 220.1804870 4.3224287
)
It is Exec permission issue or Swetest 32 bit issue or 64 bit issue. Output comes on terminal while on browser the array is empty. Please advice.
I am using Cpanel with Alamlinux 9 on a VPS.