Find the answer to your Linux question:
Results 1 to 2 of 2
i want to run shell scripts in web with php.it worked in simple command like : <?php $output = shell_exec('ls -lart'); echo "<pre>$output</pre>"; ?> but when i test with command ...
  1. #1
    Just Joined!
    Join Date
    Jul 2010
    Posts
    11

    Question php CGI

    i want to run shell scripts in web with php.it worked in simple command like :
    <?php
    $output = shell_exec('ls -lart');
    echo "<pre>$output</pre>";
    ?>
    but when i test with command like "# service iptables start
    " it dosent work.because of limit access.
    i think in the browser,php is runng under one user,bu when u run it in bash,it is likely running with your user premmission(root)
    i added "chmod +x ..." to command but it dosnt work yet!
    plz help.tanxxx

  2. #2
    Just Joined!
    Join Date
    Jul 2010
    Posts
    11

    Red face

    hi.english is my secode language so sorry for any mistake.anyway tanx 4 any help.my problem is solved.
    solution:

    i added "apache ALL=NOPASSWD : ALL" to "/etc/sudoers" file
    and make COMMENT " Defaults requiretty" to "/etc/sudoers" file

    i can do "# service iptables start " or ...

    now the the problem is that i have GUI "dialog utility " in my scripts.when i run it in web it dosent work and the errors are so strange.its like that i cant run dialog utility in web.what do u think about it?tanx

Posting Permissions

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