我已经使用了搜索 -
我在命令提示符下的 Windows 服务器上有一个共享驱动器,我可以在运行 youtube-dl 的驱动器上写入,但是从 PHP 脚本 - youtube-dl 说permission error ( no permission error on local drive)
如果我从命令提示符以 root 身份运行包含 youtube-dl 的 PHP 脚本,它工作正常。
下面是php脚本
echo "Saving $v";
$url = "http://www.youtube.com/watch?v=$v";
$template = '/windowshare/%(id)s.%(ext)s';
$string = ('youtube-dl ' . escapeshellarg($url) . ' -f 22 -o ' .
escapeshellarg($template));
$descriptorspec = array(
0 => array("pipe", "r"), // stdin
1 => array("pipe", "w"), // stdout
2 => array("pipe", "w"), // stderr
);
$process = proc_open($string, $descriptorspec, $pipes);
$stdout = stream_get_contents($pipes[1]);
fclose($pipes[1]);
$stderr = stream_get_contents($pipes[2]);
fclose($pipes[2]);
$ret = proc_close($process);
echo json_encode(array('status' => $ret, 'errors' => $stderr,
'url_orginal'=>$url, 'output' => $stdout,
'command' => $string));