windows 2000 + Apache 2.0 + PHP4.3.10 下运行结果:Content-type: text/html X-Powered-By: PHP/4.3.10Hello World!command returned 0
OK,我在linux也运行通过了.我再试试...换成调用别的应用程序...
没解决,只是回复了三次,我不能回复了..换成<?php $descriptorspec = 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", "c:/error-output.txt", "a") // stderr is a file to write to ); $process = proc_open("c:/myferly/mysql/bin/mysqldump -u root -p -h localhost aaa>a.sql", $descriptorspec, $pipes); if (is_resource($process)) { // $pipes now looks like this: // 0 => writeable handle connected to child stdin // 1 => readable handle connected to child stdout // Any error output will be appended to /tmp/error-output.txt fwrite($pipes[0], "我在这里输入我的mysql密码"); fclose($pipes[0]); while(!feof($pipes[1])) { echo fgets($pipes[1], 1024); } fclose($pipes[1]); // It is important that you close any pipes before calling // proc_close in order to avoid a deadlock $return_value = proc_close($process); echo "command returned $return_value\n"; } ?> 这样就不行了,有高手可以解决吗,分不够再加.....
X-Powered-By: PHP/4.3.10Hello World!command returned 0
$descriptorspec = 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", "c:/error-output.txt", "a") // stderr is a file to write to
);
$process = proc_open("c:/myferly/mysql/bin/mysqldump -u root -p -h localhost aaa>a.sql", $descriptorspec, $pipes);
if (is_resource($process)) {
// $pipes now looks like this:
// 0 => writeable handle connected to child stdin
// 1 => readable handle connected to child stdout
// Any error output will be appended to /tmp/error-output.txt fwrite($pipes[0], "我在这里输入我的mysql密码");
fclose($pipes[0]); while(!feof($pipes[1])) {
echo fgets($pipes[1], 1024);
}
fclose($pipes[1]);
// It is important that you close any pipes before calling
// proc_close in order to avoid a deadlock
$return_value = proc_close($process); echo "command returned $return_value\n";
}
?>
这样就不行了,有高手可以解决吗,分不够再加.....