2014-02-26 21 views
-1

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 referencePython的導入錯誤,而使用YouTube-DL由PHP

命令我使用

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

的PHP代碼我使用

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

當你直接從命令行調用'youtube-dl'時,你會得到同樣的錯誤嗎? –

+0

不,我不好吧 –

回答

-1

你好我終於得到了解決!首先,請你讓我知道你的服務器配置?我使用的是XAMPP,在我的情況下,Apache使用的「Python」和它的libs與我的ubuntu使用的不一樣,所以我構建並安裝Python3到/ opt/lampp/bin並由我自己構建openssl。你可以從它的網站下載openssl1.0.1,並通過「./config shared」配置它來構建一個.so文件。 下一步將libssl.so *和libcrypto.so *(共4個文件)複製到/ opt/lampp/lib(這是LD_LIBRARY_PATH指向的地方),然後重新啓動apache 它適用於我,希望它能幫助你

+0

嘿,你的事情怎麼樣? – Learningpro