Closed aidinzolghadr closed 7 years ago
Hi !
First thing I'm thinking of : file permissions. Is youtube-dl available for user www-data (or your equivalent) ? Usually :
> which youtube-dl
youtube-dl is /usr/local/bin/youtube-dl
> ls -l /usr/local/bin/youtube-dl
-rwxr-xr-x 1 root root 1,4M nov. 2 21:02 /usr/local/bin/youtube-dl
Otherwise, what is your PHP version ?
Hi,
Thanks for the reply. I own a shared host so I had to install it in a custom directory and add it to PATH (Not sure if I've done this correctly).
When I run the which command via terminal, it returns the correct path it is installed.
But when I execute it via PHP, it may not get executed.
I thought maybe exec() is banned on my server but it is not.
I've tried several other variations and forks of this web UI that you forked from, same results.
My PHP version was 5 and I upgraded to 7.0 in hope for a solution but it did not change anything. I can downgrade too.
My Python is 2.7.9.
Best, Idn
On Jan 11, 2017 12:37 PM, "Kallys" notifications@github.com wrote:
Hi !
First thing I'm thinking of : file permissions. Is youtube-dl available for user www-data (or your equivalent) ? Usually :
which youtube-dl youtube-dl is /usr/local/bin/youtube-dl ls -l /usr/local/bin/youtube-dl -rwxr-xr-x 1 root root 1,4M nov. 2 21:02 /usr/local/bin/youtube-dl
Otherwise, what is your PHP version ?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Kallys/MediaDownloader/issues/3#issuecomment-271815466, or mute the thread https://github.com/notifications/unsubscribe-auth/AF8vqlwmjpvPkkoDf5Hb1AbeZF9DeFaMks5rRJvbgaJpZM4LgEsP .
I don't understand the last lines of code that you posted re permission but I did run chmod 775 on downloads folder, on all folders, 644 on all files, different combinations, no luck.
Problem is I can't see an error log. My host is 1and1 and it says to put a PHP.ini file in the root of my program with some stuff but it does not generate an error.
Thanks
On Jan 11, 2017 2:32 PM, "Aidin Zolghadr" aidinz@gmail.com wrote:
Hi,
Thanks for the reply. I own a shared host so I had to install it in a custom directory and add it to PATH (Not sure if I've done this correctly).
When I run the which command via terminal, it returns the correct path it is installed.
But when I execute it via PHP, it may not get executed.
I thought maybe exec() is banned on my server but it is not.
I've tried several other variations and forks of this web UI that you forked from, same results.
My PHP version was 5 and I upgraded to 7.0 in hope for a solution but it did not change anything. I can downgrade too.
My Python is 2.7.9.
Best, Idn
On Jan 11, 2017 12:37 PM, "Kallys" notifications@github.com wrote:
Hi !
First thing I'm thinking of : file permissions. Is youtube-dl available for user www-data (or your equivalent) ? Usually :
which youtube-dl youtube-dl is /usr/local/bin/youtube-dl ls -l /usr/local/bin/youtube-dl -rwxr-xr-x 1 root root 1,4M nov. 2 21:02 /usr/local/bin/youtube-dl
Otherwise, what is your PHP version ?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Kallys/MediaDownloader/issues/3#issuecomment-271815466, or mute the thread https://github.com/notifications/unsubscribe-auth/AF8vqlwmjpvPkkoDf5Hb1AbeZF9DeFaMks5rRJvbgaJpZM4LgEsP .
I think the issue is either youtube-dl is not executable for your php user, or, has you said, exec() is restricted on your host.
chmod a+rx path/to/youtube-dl
)chmod a+r path/to/whoami.php
)
Insert the following code into this file :
<?php
echo exec('whoami');
?>
Browse to the corresponding URL path using your web browser (http://your_domain/path/to/webroot/whoami.php).
Exec() works fine, tested before (I was not clear enough).
I did the chmod on youtube-dl directory but still says youtube-dl is not installed. Probably the which command does not return true and perhaps problem is with exec? or the user? But I call exec via browser and works fine.
I have one other possibility, maybe youtube-dl is not in path of apache and thus not visible to it. I added it to bashc I think to make it work via terminal.
And what about sudo -u www-data which youtube-dl
or sudo -u www-data youtube-dl
?
(I assume your PHP user is www-data, adapt previous line otherwise)
You could also check if your path to youtube-dl is in PHP Environment PATH variable by displaying PHP infos.
<?php
phpinfo();
?>
1) I don't have root access and don't have sudo nor can install it. Any other way to run that command?
2) PHP version was NOT 7 but 5.3, updated to 7.
3) I ran phpinfo() and it did not had any "youtube-dl" in it.
Thank you for your persistent care.
You shouldn't see directly youtube-dl inside phpinfo() ; but be sure youtube-dl directory is listed inside PATH variable.
For example, mine is : phpinfo()'s PATH is "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" And youtube-dl path is "/usr/local/bin/youtube-dl"
No it doesn't contain my youtube-dl's parent directory. My PATH is just
/bin:/usr/bin
Which I think is default and I probably can't change. I've read that I can put a php.ini inside the folder of the project with a include_path line and static address of youtube-dl, but it didn't work as well.
I've read that php.ini needs to be in ALL folders that uses php, so I did copy my php.ini to all folders, even js one! Just to be sure! haha.
But same result. Maybe my php.ini file is not correct:
include_path = "/zirta/hib/htdocs/.linuxbrew/bin/youtube-dl"
I've seen paths to have single dot in the beginning, so I'm not sure if I'm doing it right.
You can try to add the following line in init.php line 10 :
set_include_path(get_include_path() . PATH_SEPARATOR . '/zirta/hib/htdocs/.linuxbrew/bin');
Not tested and it's too late to go further for me. On next version of MediaDownloader, I've added a way to manually specify path to youtube-dl, but next version is not for soon...
Sadly that did not work.
Thank you so much for all your time and effort, it's really appreciated.
I'm not very familiar with restricted server environments but I tried to reproduce something similar and I made it working this way :
chmod a+rx /var/www/html/youtube-dl
putenv('PATH=' . getenv('PATH') . PATH_SEPARATOR . '/var/www/html');
But maybe putenv() is restricted on your server (but normally PHP safe mode has been removed in PHP7).
The ultimate solution that will work for sure is to hardcode youtube-dl path. Replace every occurrence of "youtube-dl" by "/zirta/hib/htdocs/.linuxbrew/bin/youtube-dl" in code. GitHub may help you.
Thanks.
First method didn't work, I went after the second one but there are more instances of youtube-dl that I had to change, strangely enough.
So I did that and it now shows file's properties and stuff but when I press download, it goes to download.php which is in root and throws an error:
Fatal error: Uncaught Error: Call to a member function load() on null in /MediaDownloader/download.php:8 Stack trace: #0 {main} thrown in /MediaDownloader/download.php on line 8
I think it means the $session is null.
You're right, now fixed : 50c1730dcddf6e830717f0e03aa3649f35bd5d37 Thanks!
Thanks, I just did your patch but now after I press download, it just loads the default screen. Same thing after going to the "Let me choose quality" and pressing download button.
Sounds good ! Normally you should see "Background downloads" on 1/3 until download finish. Then your file should be listed in "Files" page (and available in your download directory).
That's what I hoped for. There was no background download, even though I put a large youtube file to make sure it doesn't finish fast so I would not miss it. I checked the files section and it was empty.
I also chacked permission for downloads/ and it was "drwx---r-x "
so to make sure I changed it to 777, same results.
Hum, strange. Have you tried the "Direct download" button ? Does it work ? Can I see your edited Downloader.php file ?
I put a direct link to a zip file in the box and pressed direct download and it came up with this error:
Fatal error: Uncaught Error: Call to a member function GetStreamType() on null in /home/MediaDownloader/lib/Views/FormatSelection.php:88 Stack trace: #0 /home/MediaDownloader/download.php(68): MediaDownloader\Views\FormatSelection::PrintMediaFormatSelection(Object(MediaDownloader\MediaInfo), false, true) #1 {main} thrown in /home/MediaDownloader/lib/Views/FormatSelection.php on line 88
And for my Downloader.php, here it is: http://pastebin.com/kEhqdi83
Actually, "Download" means "Download to server (from hosting service)" and "Direct download" means "Download to client (from hosting service)". (That's the first reason why I forked to p1rox's because on his version you can only download from hosting service to server and then, download from server to client.)
So don't put a link to a zip file in the box, try with a youtube URL and then press the "Direct download" button.
Then, I checked your Downloader.php file, and there is still some occurences of "youtube-dl" that you didn't replace. Here is a the right one for your: https://framabin.org/?ffacb578702d2ac9#v6N90mDaPNMMv7JZnWyGAT+Pu0sZwgb36vdXG3GZQFY=
Hey thanks it works! yay.
Is it possible to queue downloads? Like I have 10 links but I want it to download 3 files simultaneously, currently if you put how many links, it tries to download them all at once.
Should be available in next version ! I'm working on it, but another project is currently taking all my time...
Since your problem is solved, I close this issue, but don't hesitate to open a new one if you find bugs or have suggestions. Thanks for your time and helping to improve MediaDownloader !
Hi,
It says youtube-dl is not installed but it is and I can run it via terminal. Also "which " is installed and "which youtube-dl" returns correct path but still the check in line #130 of Downloader.php in lib returns false.
I even commented it out as I'm sure it is not necessary (not a good approach but I need to get it working fast) but it sill won't work. When I put a URL and press download, it reloads and does nothing, nothing in the download jobs either.
Thanks.