Professional Web Applications Themes

exec() - PHP Development

i cannot execute the exec command and pass varaible through it exec('/secure/sed_repl.sh "route add -host $obj->host device $device2" "" '); I have to execute it this way ... exec('/secure/sed_repl.sh "this one" "this one to" '); thanks...

  1. #1

    Default exec()

    i cannot execute the exec command and pass varaible through it

    exec('/secure/sed_repl.sh "route add -host $obj->host device $device2" ""
    ');

    I have to execute it this way ...

    exec('/secure/sed_repl.sh "this one" "this one to" ');

    thanks


    manu Guest

  2. #2

    Default Re: exec()

    > i cannot execute the exec command and pass varaible through it
    > exec('/secure/sed_repl.sh "route add -host $obj->host device $device2" ""
    ');

    you cannot use single quote with variable values
    try
    exec("/secure/sed_repl.sh \"route add -host $obj->host device $device2\"
    \"\" ");


    Juz Guest

  3. #3

    Default Re: exec()

    Try this:

    exec('/secure/sed_repl.sh "route add -host ' . $obj->host . ' device '
    .. $device2 . '");

    or

    exec("/secure/sed_repl.sh \"route add -host " . $obj->host . " device
    $device2\"");

    You have to keep in mind that when using single quotes, they will not
    translate variables. Objects, like arrays, do not get translated
    inside of both single or double quotes. Therefore, you simply concat
    them together, like in the example above. Let me know if this helped.

    On Thu, 17 Jun 2004 14:42:12 +0000 (UTC), "manu"
    <msinghpentagon-systems.com> wrote:
    >i cannot execute the exec command and pass varaible through it
    >
    >exec('/secure/sed_repl.sh "route add -host $obj->host device $device2" ""
    >');
    >
    >I have to execute it this way ...
    >
    >exec('/secure/sed_repl.sh "this one" "this one to" ');
    >
    >thanks
    >
    eclipsboi Guest

  4. #4

    Default exec()

    can anyone help me:

    using exec() function in PHP i can execute linux programms like ls,who
    and other, however i can not execute my own C programms and i really
    don't know why.

    My C programms compiled ,executes perfectly from command line, however
    they cannot be executed from the web. unix system. it doesn't matter if
    the programms takes or doesn't take parameters. I'm trying the simplest
    C programm that should write out few letters. i even added compiled
    programm to the PATH directory. and the result is the same..

    i'm trying to do so:
    exec("progs");
    or passthru("progs");
    even when i add all the path it doesn't take any result.
    i tried exec("./progs 2> error_file");
    when compiled programm is in the directory where the script is, then the
    error_file looks like:
    ../progs: syntax error at line 1: '(' unexpected
    what the hell does it mean??
    ../progs exectuted from command line does what he should do very good..

    Please help me,
    Peter
    Piotr Wolski Guest

  5. #5

    Default Re: exec()

    Piotr Wolski wrote:
    > can anyone help me:
    >
    > using exec() function in PHP i can execute linux programms like ls,who
    > and other, however i can not execute my own C programms and i really
    > don't know why.
    >
    > My C programms compiled ,executes perfectly from command line, however
    > they cannot be executed from the web. unix system. it doesn't matter if
    > the programms takes or doesn't take parameters. I'm trying the simplest
    > C programm that should write out few letters. i even added compiled
    > programm to the PATH directory. and the result is the same..
    >
    > i'm trying to do so:
    > exec("progs");
    > or passthru("progs");
    > even when i add all the path it doesn't take any result.
    > i tried exec("./progs 2> error_file");
    > when compiled programm is in the directory where the script is, then the
    > error_file looks like:
    > ./progs: syntax error at line 1: '(' unexpected
    > what the hell does it mean??
    > ./progs exectuted from command line does what he should do very good..
    >
    > Please help me,
    > Peter
    What is your webserver setup like? are you possibly trying to run for
    example c compiled code through some interpreter?
    /G
    --
    --
    [url]www.gh-webinteractive.com[/url]

    svenne Guest

  6. #6

    Default Re: exec()

    svenne wrote:
    > Piotr Wolski wrote:
    >
    >
    >>can anyone help me:
    >>
    >>using exec() function in PHP i can execute linux programms like ls,who
    >>and other, however i can not execute my own C programms and i really
    >>don't know why.
    >>
    >>My C programms compiled ,executes perfectly from command line, however
    >>they cannot be executed from the web. unix system. it doesn't matter if
    >>the programms takes or doesn't take parameters. I'm trying the simplest
    >>C programm that should write out few letters. i even added compiled
    >>programm to the PATH directory. and the result is the same..
    >>
    >>i'm trying to do so:
    >>exec("progs");
    >>or passthru("progs");
    >>even when i add all the path it doesn't take any result.
    >>i tried exec("./progs 2> error_file");
    >>when compiled programm is in the directory where the script is, then the
    >>error_file looks like:
    >>./progs: syntax error at line 1: '(' unexpected
    >>what the hell does it mean??
    >>./progs exectuted from command line does what he should do very good..
    >>
    >>Please help me,
    >> Peter
    >
    > What is your webserver setup like? are you possibly trying to run for
    > example c compiled code through some interpreter?
    > /G
    could you please specify your questions?;)
    Piotr Wolski Guest

  7. #7

    Default Re: exec()

    My question is, are you running PHP in safe mode?

    On Tue, 13 Jul 2004 15:33:24 -0500, Piotr Wolski
    <wolskics.purdue.edu> wrote:
    >svenne wrote:
    >> Piotr Wolski wrote:
    >>
    >>
    >>>can anyone help me:
    >>>
    >>>using exec() function in PHP i can execute linux programms like ls,who
    >>>and other, however i can not execute my own C programms and i really
    >>>don't know why.
    >>>
    >>>My C programms compiled ,executes perfectly from command line, however
    >>>they cannot be executed from the web. unix system. it doesn't matter if
    >>>the programms takes or doesn't take parameters. I'm trying the simplest
    >>>C programm that should write out few letters. i even added compiled
    >>>programm to the PATH directory. and the result is the same..
    >>>
    >>>i'm trying to do so:
    >>>exec("progs");
    >>>or passthru("progs");
    >>>even when i add all the path it doesn't take any result.
    >>>i tried exec("./progs 2> error_file");
    >>>when compiled programm is in the directory where the script is, then the
    >>>error_file looks like:
    >>>./progs: syntax error at line 1: '(' unexpected
    >>>what the hell does it mean??
    >>>./progs exectuted from command line does what he should do very good..
    >>>
    >>>Please help me,
    >>> Peter
    >>
    >> What is your webserver setup like? are you possibly trying to run for
    >> example c compiled code through some interpreter?
    >> /G
    >
    >could you please specify your questions?;)
    eclipsboi Guest

Similar Threads

  1. exec() function
    By Weapons of Mass Destruction in forum PHP Development
    Replies: 1
    Last Post: November 19th, 08:55 AM
  2. [Q] cannot exec *.rbx with mod_ruby
    By kwatch in forum Ruby
    Replies: 0
    Last Post: October 14th, 12:19 PM
  3. How to exec PHP as CGI
    By Lowell Allen in forum PHP Development
    Replies: 0
    Last Post: August 27th, 08:49 PM
  4. Replies: 0
    Last Post: December 10th, 09:27 AM

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139