fwrite($pipes[0], "<?php echo \"Hello World!\"; ?>")
===========
你是说这个??

解决方案 »

  1.   

    fwrite(STDIN, "我的密码");我用了这个也不行...这个会创建一个新的in.我要在被调用的程序中打开的in中输入密码,而不是创建一个新的stdin,晕...救命啊....
      

  2.   

    windows 2000 + Apache 2.0 + PHP4.3.10 下运行结果:Content-type: text/html
    X-Powered-By: PHP/4.3.10Hello World!command returned 0
      

  3.   

    OK,我在linux也运行通过了.我再试试...换成调用别的应用程序...
      

  4.   

    没解决,只是回复了三次,我不能回复了..换成<?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";
    }
    ?>
    这样就不行了,有高手可以解决吗,分不够再加.....
      

  5.   

    这段代码应该是没有问题的,是不是得php.exe的路径不对?$process = proc_open("c:/myferly/php/php", $descriptorspec, $pipes);c:/myferly/php/php需要是真实的php.exe的路径,你确定"c:/myferly/php/php.exe"这个路径对马?
      

  6.   

    fwrite($pipes[0], "我在这里输入我的mysql密码" + "\n");这样试试看