Alexandre
PHPПенсионер
zip с паролем
хотелось бы использовать стандартную фичу РНР, но не получилось.
использую командную строку: zip -e project..zip *
как и полагается - делаю через proc_open, пробовал по разному, ошибку пишет:
zip error: Invalid command arguments (stderr is not a tty)
код возврата 16
обратится напрямую к tty не получается,
кто знает, как в рнр съэмулировать tty
первоночально пробовал:$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w"),
2 => array("pipe", "r")
);
-~{}~ 16.07.08 17:36:
вопрос решил использованием minizip
хотелось бы использовать стандартную фичу РНР, но не получилось.
использую командную строку: zip -e project..zip *
как и полагается - делаю через proc_open, пробовал по разному, ошибку пишет:
zip error: Invalid command arguments (stderr is not a tty)
код возврата 16
обратится напрямую к tty не получается,
кто знает, как в рнр съэмулировать tty
PHP:
$desc = 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("pty"), // stderr is pipe
// 3 => array("pipe", "w") // user is pipe
);
$process = proc_open('zip -e project3.zip *', $desc, $pipes, $cwd);
if (is_resource($process)) {
// Push input into StdIn
// fwrite($pipes[0], '12345');
// Read StdOut
$StdOut = '';
while(!feof($pipes[1])) {
$StdOut .= fgets($pipes[1], 1024);
}
echo "<br>stdOut: $StdOut";
fwrite($pipes[0], '12345');
// Read StdErr
$StdErr = '';
while(!feof($pipes[2])) {
$StdErr .= fgets($pipes[2], 1024);
}
fclose($pipes[2]);
fclose($pipes[0]);
fclose($pipes[1]);
// Close the process
$ReturnCode = proc_close($process);
echo "<br>command returned $ReturnCode\n";
echo "<br>error: $StdErr";
}
0 => array("pipe", "r"),
1 => array("pipe", "w"),
2 => array("pipe", "r")
);
-~{}~ 16.07.08 17:36:
вопрос решил использованием minizip