我尝试过 exec、shell_exec、system 但它们对我不起作用。
<?php
shell_exec('gnome-terminal');
?>
我尝试过 exec、shell_exec、system 但它们对我不起作用。
<?php
shell_exec('gnome-terminal');
?>
看起来你想通过 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 );
}
?>