exec problem ?!?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • rain

    exec problem ?!?

    Hello,
    I am having some serious problems executing a command on my redhat linux
    machine using exec, shell_exec, or any variants thereof.

    I have a string saved into a variable like:

    $mystring = "/usr/local/bin/lmc -e add /music/whatever.mp3";

    Then I try to execute w/ something like:

    $last_line = exec($mystring) ;
    echo "{$last_lin e}";

    This does absolutely nothing but when I run the same thing from the
    command line it works fine. I also have made sure that it is not running
    in safety_mode. The current user is nobody, but the program is accessable
    to everyone. Any thoughts or places where I need ot provide more info?
    Any suggestions to troubleshoot?

    Brian

    PS: this is driving me bonkers.
  • Leslie Hoare

    #2
    Re: exec problem ?!?

    try system() maybe?

    --
    Leslie

    "rain" <deadheadHATESP AM@nc.rr.com> wrote in message
    news:pan.2003.0 7.26.02.47.56.7 49765@nc.rr.com ...[color=blue]
    > Hello,
    > I am having some serious problems executing a command on my redhat linux
    > machine using exec, shell_exec, or any variants thereof.
    >
    > I have a string saved into a variable like:
    >
    > $mystring = "/usr/local/bin/lmc -e add /music/whatever.mp3";
    >
    > Then I try to execute w/ something like:
    >
    > $last_line = exec($mystring) ;
    > echo "{$last_lin e}";
    >
    > This does absolutely nothing but when I run the same thing from the
    > command line it works fine. I also have made sure that it is not running
    > in safety_mode. The current user is nobody, but the program is accessable
    > to everyone. Any thoughts or places where I need ot provide more info?
    > Any suggestions to troubleshoot?
    >
    > Brian
    >
    > PS: this is driving me bonkers.[/color]


    Comment

    • rain

      #3
      Re: exec problem ?!?

      On Sat, 26 Jul 2003 07:30:39 +0100, Leslie Hoare wrote:
      [color=blue]
      > try system() maybe?[/color]

      I've tried w/ no success: system(), passthru(), fpassthru(), exec(), and
      shell_exec().

      Interestingly though I can't get any response from any of these commands.
      Even when I execute a system command w/ one of the above funtions which
      should return an error I receive nothin on a variable like $temp where the
      code is:

      $temp = exec("Code that will produce an error");

      Any other thoughts

      Thanks!

      Comment

      • Andy Hassall

        #4
        Re: exec problem ?!?

        On Sat, 26 Jul 2003 08:36:08 GMT, "rain" <deadheadHATESP AM@nc.rr.com>
        wrote:
        [color=blue]
        >On Sat, 26 Jul 2003 07:30:39 +0100, Leslie Hoare wrote:
        >[color=green]
        >> try system() maybe?[/color]
        >
        >I've tried w/ no success: system(), passthru(), fpassthru(), exec(), and
        >shell_exec() .
        >
        >Interestingl y though I can't get any response from any of these commands.
        >Even when I execute a system command w/ one of the above funtions which
        >should return an error I receive nothin on a variable like $temp where the
        >code is:
        >
        >$temp = exec("Code that will produce an error");
        >
        >Any other thoughts[/color]

        What return code are you getting? (See the third parameter to exec()
        in the manual).

        Andy Hassall (andy@andyh.co. uk) icq(5747695) (http://www.andyh.co.uk)
        Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)

        Comment

        Working...