Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2004
    Posts
    30

    Unanswered: what is the difference between backticks and exec?

    what is the difference between backticks and exec?

    i can run both (1) & (2) but how come i failed at (3) ?
    (1)
    Code:
    exec("ls -l", $result);
    
    $buffer="";
    foreach($result as $line) { $buffer.=$line; }
    
    echo $buffer;
    (2)
    Code:
    $ls=`ls -l /home/yahoo/gaelaine`;
    #exec("ls -l /home/yahoo/gaelaine",$ls);
    echo $ls;
    (3) .... NG
    Code:
    exec("./testscript1.sh",$result);
    echo $result;
    (4) .... OK
    Code:
    $a=`./testscript1.sh`;
    echo "<pre>$a</pre>";

  2. #2
    Join Date
    Jan 2004
    Location
    India
    Posts
    168
    What about (4)? One of the reason fo this is the permission to execute the testscript1.sh file. give 755 permission to the shell file and then try to do the (3) and (4).. it will work.
    to give permission use chmod 755 filename

    regards
    Rajesh

Posting Permissions

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