【发布时间】:2014-12-18 08:50:32
【问题描述】:
我用过搜索-
我在 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));
【问题讨论】:
-
ls -la /windowshare以 root 身份运行时的输出是什么?这听起来像是权限问题。 -
嗨,总共 60498714 drwxr-xr-x 1 根 98304 12 月 14 日 05:01。 drwxrwxrwx 10 根 12288 12 月 18 日 19:30 .. -rwxr-xr-x 1 根 69870400 2011 年 11 月 17 日 -rwxr-xr-x 1 根 1346825 2007 年 10 月 8 日 -rwxr-xr-x 1 根 19491952 10 月 8 日2007 drwxr-xr-x 1 根 0 Apr 7 2014 -rwxr-xr-x 1 根 9662390 11 月 23 日 16:17 -rwxr-xr-x 1 根 3972200 11 月 12 日 15:13
标签: php youtube youtube-dl