2013-09-05 2 views
0

나는 exec, shell_exec, system을 시도했지만 그들은 나를 위해 일하지 않았다.어떻게 우분투에서 PHP 명령을 통해 터미널을 열 수 있습니까?

<?php 
shell_exec('gnome-terminal'); 
?> 
+1

당신은 어떤 오류가나요이 있는지 확인하십시오 경우 그것은 .... 보인다 메시지? –

+3

왜 그렇게하고 싶습니까? 해당 터미널을 사용하려면 컴퓨터에 앉아 있어야하며, 그렇게하면 직접 열 수 있습니다. – Thilo

+0

@DanielS라는 오류 메시지가 없습니다. –

답변

0

당신이 PHP를 통해 바이너리 파일을 실행하려는 것처럼이 ... 또한 이진 파일이 0777 권한

<?php 

//Command 
$cmd = './svdpp --training=/home/zubair/graphchi_v0.2.6/graphchi/smallnetflix_mm.train.txt --validation=/home/zubair/graphchi_v0.2.6/graphchi/smallnetflix_mm.validate.txt --binary_relevance_thresh=4 --sgd_gamma=1e-6 --max_iter=30 --quiet=1 --sgd_step_dec=0.9999 --sgd_lambda=1e-6 --D=3 --minival=1 --maxval=10'; 


//Binary Directory Path 
$cwd = '/toolkits/collaborative_filtering/'; 

$descriptorspec = array (
     0 => array (
       "pipe", 
       "r" 
     ), 
     1 => array (
       "pipe", 
       "w" 
     ), 
     2 => array (
       "pipe", 
       "r" 
     ) 
); 

$process = proc_open ($cmd, $descriptorspec, $pipes, $cwd); 

if (is_resource ($process)) { 
    fclose ($pipes [0]); 

    echo 'Progress Output >> ' . stream_get_contents ($pipes [1]); 
    fclose ($pipes [1]); 

    echo 'Error >> ' . stream_get_contents ($pipes [2]); 
    fclose ($pipes [2]); 

    echo 'Proce_close >> '.proc_close ($process); 
} 

?> 
+0

친애하는 Rajesh R 내가 실행했습니다 그것과 나에게 오류를 줬어 ... "Progress Output >> Error >> Proce_close >> 127" –

+0

127은 찾을 수 없기 때문에 (/ toolkits/collaborative_filtering/svdpp) –