Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

php exec can't run it #69

Closed
benoon opened this issue Feb 4, 2011 · 7 comments
Closed

php exec can't run it #69

benoon opened this issue Feb 4, 2011 · 7 comments
Labels
php

Comments

@benoon
Copy link

@benoon benoon commented 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?

@rg3
Copy link
Collaborator

@rg3 rg3 commented 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
@benoon
Copy link
Author

@benoon benoon commented Feb 5, 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!

@rg3
Copy link
Collaborator

@rg3 rg3 commented 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.

@benoon
Copy link
Author

@benoon benoon commented 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.

@rg3
Copy link
Collaborator

@rg3 rg3 commented 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.

@benoon
Copy link
Author

@benoon benoon commented Feb 8, 2011

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

thanks for your answers.

@rg3
Copy link
Collaborator

@rg3 rg3 commented Feb 10, 2011

Bad advice, IMHO, but whatever floats your boat.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.