Results 1 to 7 of 7

Thread: php: options in exec() don't seem to work

  1. #1
    Join Date
    Mar 2008
    Beans
    4

    php: options in exec() don't seem to work

    hi there,

    i'm trying to do exec('ivtv-tune -f 100') in php but it seems like it won't except the '-f 100' part. I've tried escaping it or using quotes around it but i can't get it to work.

    Does anybody have a solution to this? Thanks for reading.

  2. #2
    Join Date
    Apr 2009
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: php: options in exec() don't seem to work

    Quote Originally Posted by thundercunt View Post
    i'm trying to do exec('ivtv-tune -f 100') in php but it seems like it won't except the '-f 100' part. I've tried escaping it or using quotes around it but i can't get it to work.
    I'm assuming you mean "accept" instead of "except"?

    Have you tried to use that same command in terminal? What's it saying there?

  3. #3
    Join Date
    Mar 2008
    Beans
    4

    Re: php: options in exec() don't seem to work

    Quote Originally Posted by new_tolinux View Post
    I'm assuming you mean "accept" instead of "except"?

    Have you tried to use that same command in terminal? What's it saying there?
    oh lol, i mean accept (sorry, i'm on a phone). Yes it works with regular command line. When i use it with php, it returns all the options and arguments i can use (like when you only type the name of a program that requires arguments)

  4. #4
    Join Date
    Apr 2009
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: php: options in exec() don't seem to work

    What I read from here is:
    -fFLOAT --frequency=FLOAT set new frequency (MHz)
    What I see in your commandline there is a space between -f and 100:
    -f 100
    Probably you'll need to remove that.
    I don't know the package, so I only tell what I just read.

  5. #5
    Join Date
    Mar 2008
    Beans
    4

    Re: php: options in exec() don't seem to work

    thank you for answering. There is a space there, yes. However, wether i use exec('ivtv-tune -f 100') or exec('ivtv-tune --frequency=100') i get the same result (as if i gave no parameters), but both ways work when i use regular command line interface.

  6. #6
    Join Date
    Apr 2009
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: php: options in exec() don't seem to work

    Quote Originally Posted by thundercunt View Post
    thank you for answering. There is a space there, yes. However, wether i use exec('ivtv-tune -f 100') or exec('ivtv-tune --frequency=100') i get the same result (as if i gave no parameters), but both ways work when i use regular command line interface.
    I guess it's not going to change anything, but I never use single quotes with exec.
    That's mostly because with MySQL-queries '".$somevar."' is more simple to me than \"".$somevar."\" but as a result of that I always use double quotes (1x ") to define PHP commands.

    Another way to try could be:
    $somevar="ivtv-tune --frequency=100";
    exec($somevar);

  7. #7
    Join Date
    Mar 2008
    Beans
    4

    Smile Re: php: options in exec() don't seem to work

    Thanks for your reply, I tried it but it didn't work. I've found a way to make it work though. The answer was to just simply use sudo (or just change the user/rights that php/apache uses of course):

    Code:
    system("sudo ivtv-tune -f 100");
    Last edited by fairieswearboots; June 6th, 2010 at 12:37 PM.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •