В том-то и дело, что винда-сервер. На FreeBSD не все работает.
3 варианта
PHP код:
$status_man = system ("whoami", $outputexec);
echo '<hr>$process 1';
$descriptorspec = array(
0 => array("pty"), // stdin is a pipe that the child will read from
1 => array("pty"), // stdout is a pipe that the child will write to
2 => array("file", "/var/tmp/error-output.txt", "a") // stderr is a file to write to
);
$process = proc_open("cvs -d :pserver:anoncvs@anoncvs.at.FreeBSD.org:/home/ncvs login", $descriptorspec, $pipes);
if (is_resource($process)) {
sleep(5);
fwrite($pipes[0], "anoncvs");
sleep(5);
fwrite($pipes[0], "cvs status");
sleep(1);
}
echo '<hr>$process 2';
$descriptorspec2 = array(
0 => array("pty", "r"), // stdin is a pipe that the child will read from
1 => array("pty", "w"), // stdout is a pipe that the child will write to
2 => array("file", "/var/tmp/error-output.txt", "a") // stderr is a file to write to
);
$process2 = proc_open("cvs -d :pserver:anoncvs@anoncvs.at.FreeBSD.org:/home/ncvs login", $descriptorspec2, $pipes2);
if (is_resource($process2)) {
sleep(5);
fwrite($pipes2[0], "anoncvs");
sleep(5);
fwrite($pipes2[0], "cvs status");
sleep(1);
}
echo '<hr>$process 3';
$descriptorspec3 = array(
0 => array("pipe", "r"), // stdin is a pipe that the child will read from
1 => array("pipe", "w"), // stdout is a pipe that the child will write to
2 => array("file", "/var/tmp/error-output.txt", "a") // stderr is a file to write to
);
$process3 = proc_open("cvs -d :pserver:anoncvs@anoncvs.at.FreeBSD.org:/home/ncvs login", $descriptorspec3, $pipes3);
if (is_resource($process3)) {
sleep(5);
fwrite($pipes3[0], "anoncvs");
sleep(5);
fwrite($pipes3[0], "cvs status");
sleep(1);
}
Что возвращает сервер- lighttpd, запущен от имени пользователя dokuwiki, группа его же. PHP5 как FastCGI.
Цитата:
dokuwiki dokuwiki
--------------------------------------------------------------------------------
$process 1
Warning: proc_open() [function.proc-open]: failed to open /dev/ptmx, errno 2 in /home/dokuwiki/test.php on line 52
--------------------------------------------------------------------------------
$process 2
Warning: proc_open() [function.proc-open]: failed to open /dev/ptmx, errno 2 in /home/dokuwiki/test.php on line 68
--------------------------------------------------------------------------------
$process 3
|
лог-файл
Цитата:
CVS password:
cvs login: warning: failed to open //.cvspass for reading: No such file or directory
cvs [login aborted]: could not open //.cvspass for writing: Permission denied
|
Все три строчки от третьего варианта.
Если убрать сервер, то пишется, что не установлен CVSROOT, хотя в .profile он прописан (шелл - sh).
Если сделать su dokuwiki и попытатся залогинится, то все нормально.
Под FreeBSD год назад был патч
http://www.mail-archive.com/internal.../msg14854.html
Сейчас он не работает. Вернее сам файл proc_open.c изменился, что при make patch - либо ошибка в патче, либо он просто игнорируется.