php exec can't run it #55

Closed
opened 2026-02-20 21:00:52 -05:00 by deekerman · 7 comments
Owner

Originally created by @benoon on GitHub (Feb 4, 2011).

so i wrote some simple python script to check it with exec('python26 simple.py') and it runs without problems, however when i try exec('python26 youtube-dl') it doesn' run.
when i run my script on shell from command line it runs. when i do that from the browser it is not runned.

why?

Originally created by @benoon on GitHub (Feb 4, 2011). so i wrote some simple python script to check it with exec('python26 simple.py') and it runs without problems, however when i try exec('python26 youtube-dl') it doesn' run. when i run my script on shell from command line it runs. when i do that from the browser it is not runned. why?
deekerman 2026-02-20 21:00:52 -05:00
  • closed this issue
  • added the
    php
    label
Author
Owner

@rg3 commented on GitHub (Feb 4, 2011):

Who knows? "It doesn't run" couldn't be less specific. I doubt this is a problem with youtube-dl, though, so I'm closing the issue.

$ php <<EOF
> <?php exec('/home/rg3/bin/youtube-dl'); ?>
> EOF
Usage: youtube-dl [options] url...

youtube-dl: error: you must provide at least one URL
@rg3 commented on GitHub (Feb 4, 2011): Who knows? "It doesn't run" couldn't be less specific. I doubt this is a problem with youtube-dl, though, so I'm closing the issue. ``` $ php <<EOF > <?php exec('/home/rg3/bin/youtube-dl'); ?> > EOF Usage: youtube-dl [options] url... youtube-dl: error: you must provide at least one URL ```
Author
Owner

@benoon commented on GitHub (Feb 4, 2011):

I think it's important.
user nobody can run other python scripts so why I had to use sudo for youtube-dl ?
Would be great to know that.
THX for great project!

@benoon commented on GitHub (Feb 4, 2011): I think it's important. user nobody can run other python scripts so why I had to use sudo for youtube-dl ? Would be great to know that. THX for great project!
Author
Owner

@rg3 commented on GitHub (Feb 5, 2011):

You'd need to provide much more information if you want any type of help, like the exit status of the command, the standard output, standard error...

I know for a fact many people use youtube-dl from PHP, so it's probably a mistake you're making. I'm not an expert in PHP at all.

@rg3 commented on GitHub (Feb 5, 2011): You'd need to provide much more information if you want any type of help, like the exit status of the command, the standard output, standard error... I know for a fact many people use youtube-dl from PHP, so it's probably a mistake you're making. I'm not an expert in PHP at all.
Author
Owner

@benoon commented on GitHub (Feb 5, 2011):

I would give you more info but please write how I should do this.

When I do this:

passthru('youtube-dl -h > log.txt');

I get empty log.txt file

When I run as root

passthru('sudo -u root youtube-dl -h > log.txt');

I get all the help as it should give.

So when I run this script as user 'nobody' which is default apache user it just gives no error, nothing. Is not executed at all.

It's very strange coz other python script I can run without any problems as nobody.
That's why I was asking if there are any other linux commands in your script which may not go when you have no priviliges. It could be good to give some info that for some linux commands you need to have special permissions.

Thats why I thought it's maybe not a bug but something which can save time to others later.

@benoon commented on GitHub (Feb 5, 2011): I would give you more info but please write how I should do this. When I do this: passthru('youtube-dl -h > log.txt'); I get empty log.txt file When I run as root passthru('sudo -u root youtube-dl -h > log.txt'); I get all the help as it should give. So when I run this script as user 'nobody' which is default apache user it just gives no error, nothing. Is not executed at all. It's very strange coz other python script I can run without any problems as nobody. That's why I was asking if there are any other linux commands in your script which may not go when you have no priviliges. It could be good to give some info that for some linux commands you need to have special permissions. Thats why I thought it's maybe not a bug but something which can save time to others later.
Author
Owner

@rg3 commented on GitHub (Feb 7, 2011):

There are no "Linux commands", or shell commands, in youtube-dl. I don't know how to help you here other than checking the basics like file path, permissions, owner, etc.

@rg3 commented on GitHub (Feb 7, 2011): There are no "Linux commands", or shell commands, in youtube-dl. I don't know how to help you here other than checking the basics like file path, permissions, owner, etc.
Author
Owner

@benoon commented on GitHub (Feb 7, 2011):

Ok, with sudo I can use it without any problems so if anybody find the same problem - USE SUDO !

thanks for your answers.

@benoon commented on GitHub (Feb 7, 2011): Ok, with sudo I can use it without any problems so if anybody find the same problem - USE SUDO ! thanks for your answers.
Author
Owner

@rg3 commented on GitHub (Feb 10, 2011):

Bad advice, IMHO, but whatever floats your boat.

@rg3 commented on GitHub (Feb 10, 2011): Bad advice, IMHO, but whatever floats your boat.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/youtube-dl#55
No description provided.