How to replace exec () through system command in php?
<p>My Coding is so far:</p>

<p>How  to replace  <code>exec()</code>  through system command in php?</p>

<pre><code>if($str!="success")
{
    $cmd = "rm -rf /portal/data/config/certificate/tmp/";
    $error_text="Command : ".$cmd;
    AddLog("sslconfig.php",$error_text,ERR_DEBUG_HIGH);
    $output = exec($cmd,$array1,$error_code);
    $error_text="Error code : ".$error_code;
    AddLog("sslconfig.php",$error_text,ERR_DEBUG_HIGH);
    seterror('0:|:  :|: Could not apply certificate.');
    $error_text="Could not apply certificate";
    AddLog("sslconfig.php",$error_text,ERR_INFO);
    header("Location: ssl.php");
    exit;
}

if($certName==$cert_auth)
{
    //copy the applied certificate to fireballbundle.crt
    //$output = copysslfb("/portal/data/config/certificate/".$newfile.".crt");
    $error_text="Selfsigned Certicate";
    AddLog("sslconfig.php",$error_text,ERR_DEBUG_HIGH); 
    $output="success";
} 
else 
{
    $error_text="Not Selfsigned Certicate";
    AddLog("sslconfig.php",$error_text,ERR_DEBUG_HIGH);
    $output="success";
}

if($output!="success")
{
    $cmd = "rm -rf /portal/data/config/certificate/tmp/";
    $error_text="Command : ".$cmd;
    AddLog("sslconfig.php",$error_text,ERR_DEBUG_HIGH);
    $output = exec($cmd,$array1,$error_code);
    $error_text="Error code : ".$error_code;
    AddLog("sslconfig.php",$error_text,ERR_DEBUG_HIGH);
    $error_text="Could not add certificate to fireballbundle.crt : ".$output;
    AddLog("sslconfig.php",$error_text,ERR_ERROR);
    seterror('0:|: :|: Error in applying certificate.');
    header("Location: ssl.php");
    exit;
}
</code></pre>

<p>Now I want to replace exec command with system command ?</p>

<p>I am using three times <code>exec()</code> here as shown as above code now i want to replace with <code>system ()</code> command in php</p>

<pre><code>exec("hostname",$retval);
$output = exec($cmd,$array1,$error_code);
exec($cmd,$array1,$error_code);
</code></pre>
