내 코딩은 지금까지 :PHP에서 시스템 명령어를 통해 exec()를 대체하는 방법은 무엇입니까?
어떻게 exec()
을 PHP의 시스템 명령으로 바꾸시겠습니까?
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;
}
는 지금은 시스템 명령으로 exec 명령을 대체하려면? 코드 위와 같이 내가 세 번 여기 exec()
을 사용하고
는 지금은 하나의 파일을 제거하려면 unlink을 사용해야하고 당신이해야 디렉토리를 제거
exec("hostname",$retval);
$output = exec($cmd,$array1,$error_code);
exec($cmd,$array1,$error_code);
:)이 내 ANS – John
하지 않습니다 :) 나는 또한 나의 코딩에 해제 사용하고 – John