Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Text2wave festival not working via nginx php exec

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!

like image 601
Tadej Magajna Avatar asked Jul 17 '13 12:07

Tadej Magajna


1 Answers

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');
?>
like image 51
Anil R Avatar answered Oct 04 '22 23:10

Anil R