doulu5717 2014-02-25 16:50
浏览 121

php上的ubuntu proc_open命令错误与python

i faced this problem while i was trying to use youtube-dl by php on ubuntu.

I am using XAMPP for Linux v1.8.3 (PHP 5.5.9)


The error i received after executing:

{"status":0,"errors":"Traceback (most recent call last): File \"/usr/bin/youtube-dl\", line 3, in import youtube_dl File \"/usr/lib/python2.7/dist-packages/youtube_dl/_init_.py\", line 65, in from .utils import ( File \"/usr/lib/python2.7/dist-packages/youtube_dl/utils.py\", line 18, in import ssl File \"/usr/lib/python2.7/ssl.py\", line 61, in import _ssl # if we can't import it, let the error propagate ImportError: /usr/lib/python2.7/lib-dynload/_ssl.x86_64-linux-gnu.so: symbol GENERAL_NAME_free, version OPENSSL_1.0.0 not defined in file libcrypto.so.1.0.0 with link time reference

And this is my php code

<?php
    $url = 'https://www.youtube.com/watch?v=xFQFMSNZW08&list=RDV-jLo0Ovems';
    //escapeshellarg
    $string = ('youtube-dl --max-quality 2180 --write-thumbnail -x --audio-format mp3 -c -o "/home/bahaa/%(id)s.%(ext)s" https://www.youtube.com/watch?v=xFQFMSNZW08&list=RDV-jLo0Ovems');

    $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' => str_replace(array('', "
"), "<br />", $stderr."<hr />"),
            'output' => $stdout,
        )
    );
?>

Any help will be appreciated.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 eclipse运行项目时遇到的问题
    • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
    • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
    • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
    • ¥50 成都蓉城足球俱乐部小程序抢票
    • ¥15 yolov7训练自己的数据集
    • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
    • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
    • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)
    • ¥20 matlab yalmip kkt 双层优化问题