php exec: does not return output

前端 未结 10 1062
有刺的猬
有刺的猬 2020-12-01 17:20

I have this problem: On a ISS web server, windows 7 x64 professional, zend server installed. Running this command under php:

exec(\'dir\',$output, $err);
         


        
10条回答
  •  独厮守ぢ
    2020-12-01 17:52

    Take a look at Apache error_log, maybe you'll find the error message.

    Also, you can try using popen instead of exec. It gives more control because you can separate process start from output read:

    $p = popen("dir", "r");
    if (!$p)
        exit("Cannot run command.\n");
    while (!feof($p))
        echo fgets($p);
    pclose($p);
    

提交回复
热议问题