I'm trying to run a shell command text2wave in PHP on a nginx server.
The problem is the command just exits silently without working as it should. It's also not displaying any errors.
Here's the code:
<?php
$result = `/usr/bin/text2wave --help`;
var_dump($result);
If I run the script via php command in shell ( as a normal user) it works as expected. However, If I run it via a http request through nginx the var_dump returns NULL ( there are also not logs in error log files)
Thanks for your help!
try:
<?php
function sys_cmd($cmd)
{
$hd = popen($cmd,"r") or die('function disabled');
while (!feof($hd))
{
$rs .= fread($hd,1024);
}
pclose($hd);
return $rs;
}
echo sys_cmd('ls -l');
?>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With