title: Can't exec ifconfig with php
body: <p>I can't execute ifconfig with exec() in PHP on apache. I can execute all kind of commands including ip addr list but that one sucks balls so I would really need to be able to execute ifconfig.</p>
  
  <p>I've read other posts and have made sure that the disable_functions is = "" [blank], but still no luck (I restarted apache ). It feels like it some kind of permission problem since all other commands works just fine.</p>
  
  <p>In the first file i just do exec and then cleans up the result as I want it, and I'm quite sure that isn't where the problem is, since it works fine fore other commands</p>
  
  <p>First file</p>
  
  <pre><code>function execute($command){
    exec($command, $output);
  
    $output_array;                                    // each row contains a array representing all elements in a output row
    for ($i = 0; $i &lt; sizeof($output); $i++){
      $tmp_array = explode(" ",$output[$i]);      
      $output_array[$i] = $tmp_array;
  }
  // clear the array from all ""
    $clean_array;                             
    for ($i = 0; $i &lt; sizeof($output_array); $i++){
      $tmp;
      $index = 0;
      for ($j = 0; $j &lt; sizeof($output_array[$i]); $j++){
          if (strlen($output_array[$i][$j]) &gt; 0){
              $tmp[$index++] = $output_array[$i][$j];
          }
      }
      $clean_array[$i] = $tmp;
    }
    return $clean_array;
  </code></pre>
  
  <p>second file</p>
  
  <pre><code>include "../app_includes/application_functions.php";
  $command = "ifconfig";
  //$command = "ip addr list";
  $arr = execute($command);
  // print the result
  for ($i = 0; $i &lt; sizeof($arr); $i++){
      for ($j = 0; $j &lt; sizeof($arr[$i]); $j++){
          echo $arr[$i][$j]." ";
      }
      echo "&lt;br&gt;";
  }
  </code></pre>
  
  <p>SOLVED:
   The problem was solved by executing "/sbin/ifconfig" instead of only ifconfig</p>